Subversion Repositories shark

Rev

Rev 410 | Rev 413 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
221 giacomo 1
//=====================================================================
2
//       FFFFFFIII   RRRRR      SSTTTTTTT
3
//      FF         IIR   RR    SS
4
//     FF           IR        SS
5
//    FFFFFF         RRRR    SSSSST      
6
//   FF       FI       RRR  SS
7
//  FF         II     RRR  SS
8
// FF           IIIIIR    RS 
9
//       
10
// Basic FSF(FIRST Scheduling Framework) contract management
11
// S.Ha.R.K. Implementation
12
//=====================================================================
13
 
405 trimarchi 14
#include "ll/i386/64bit.h"
15
 
221 giacomo 16
#include "fsf_contract.h"
241 giacomo 17
#include "fsf_server.h"
221 giacomo 18
 
19
#include <pthread.h>
20
#include <stdlib.h>
21
 
407 giacomo 22
//#define FSF_DEBUG
221 giacomo 23
 
410 trimarchi 24
int current_server=0;
407 giacomo 25
server_elem server_list[FSF_MAX_N_SERVERS];
406 giacomo 26
bandwidth_t fsf_max_bw = 0;
405 trimarchi 27
 
241 giacomo 28
int fsf_server_level;
221 giacomo 29
 
406 giacomo 30
int FSF_register_module(int server_level, bandwidth_t max_bw)
224 giacomo 31
{
32
  printk("FSF Module\n");
410 trimarchi 33
  current_server=0;
241 giacomo 34
  fsf_server_level = server_level;
406 giacomo 35
  fsf_max_bw = max_bw;
224 giacomo 36
 
37
  return 0;
38
 
39
}
40
 
221 giacomo 41
/* Convert the contract specification to
42
 * budget parameters
43
 */
241 giacomo 44
int set_SERVER_budget_from_contract
221 giacomo 45
  (const fsf_contract_parameters_t *contract,
46
   int *budget)
47
{
48
 
49
  int local_scheduler_level = 0;
50
 
51
   switch (contract->local_scheduler_id) {
52
     case FSF_SCHEDULER_POSIX:
241 giacomo 53
       local_scheduler_level = POSIXSTAR_register_level(fsf_server_level,5000,32);
221 giacomo 54
       break;
55
     case FSF_SCHEDULER_EDF:
241 giacomo 56
       local_scheduler_level = EDFSTAR_register_level(fsf_server_level);
221 giacomo 57
       break;
58
     case FSF_SCHEDULER_RM:
241 giacomo 59
       local_scheduler_level = RMSTAR_register_level(fsf_server_level);
221 giacomo 60
       break;
334 giacomo 61
     case FSF_SCHEDULER_MPEG:
62
       local_scheduler_level = MPEGSTAR_register_level(fsf_server_level);
63
       break;
221 giacomo 64
   }    
405 trimarchi 65
 
241 giacomo 66
  *budget = SERVER_setbudget(fsf_server_level,
221 giacomo 67
                              TIMESPEC2USEC(&(contract->budget_min)),
68
                              TIMESPEC2USEC(&(contract->period_max)),
69
                              local_scheduler_level,contract->local_scheduler_id);
70
 
71
  return 0;
72
 
73
}
74
 
405 trimarchi 75
int adjust_SERVER_budget
76
   (int budget, const TIME budget_actual,
77
    const TIME period_actual)
221 giacomo 78
{
79
 
241 giacomo 80
  SERVER_adjust_budget(fsf_server_level,
405 trimarchi 81
                       budget_actual,
82
                       period_actual,
241 giacomo 83
                       budget);
221 giacomo 84
 
85
  return 0;
86
 
87
}
88
 
89
/* Admission Test function */
90
int add_contract(const fsf_contract_parameters_t *contract)
91
{
92
  return 0;
93
 
94
}
95
 
410 trimarchi 96
int relink_contract_to_server(const fsf_contract_parameters_t *contract,
97
                              fsf_server_id_t server)
98
{
99
  TIME T,Q;
100
  int i=0;
101
#ifdef FSF_DEBUG
102
  int temp;
103
  kern_printf("(Relink Server %d)",server);
104
#endif
105
  // find contract
106
  while(i<current_server) {
107
    if (server_list[i].server==server) break;
108
    i++;
109
  }
110
 
111
  server_list[i].server=server;
112
  server_list[i].Qs=1;
113
 
114
  T=TIMESPEC2USEC(&contract->period_min);
115
  Q=TIMESPEC2USEC(&contract->budget_max);
116
  mul32div32to32(MAX_BANDWIDTH,Q,T,server_list[current_server].Umax);
117
 
118
  T=TIMESPEC2USEC(&contract->period_max);
119
  server_list[i].Tmax=T;
120
 
121
  Q=TIMESPEC2USEC(&contract->budget_min);
122
  server_list[i].Cmin=Q;
123
 
124
  mul32div32to32(MAX_BANDWIDTH,Q,T,server_list[i].Umin);
125
  server_list[i].U=server_list[i].Umax;
126
 
127
#ifdef FSF_DEBUG
128
  mul32div32to32(server_list[i].Umax,100, MAX_BANDWIDTH, temp);
129
  kern_printf("(Umax %d)",temp);
130
  mul32div32to32(server_list[i].Umin,100, MAX_BANDWIDTH, temp);
131
  kern_printf("(Umin %d)",temp);
132
#endif
133
 
134
 return 0;
135
 
136
}
137
 
221 giacomo 138
int link_contract_to_server(const fsf_contract_parameters_t *contract,
139
                            fsf_server_id_t server)
140
{
405 trimarchi 141
  TIME T,Q;
407 giacomo 142
#ifdef FSF_DEBUG
405 trimarchi 143
  int temp;
407 giacomo 144
 
405 trimarchi 145
  kern_printf("(Link Server %d)",server);
146
#endif
147
 
410 trimarchi 148
  server_list[current_server].server=server;
149
  server_list[current_server].Qs=1;
405 trimarchi 150
 
151
  T=TIMESPEC2USEC(&contract->period_min);
152
  Q=TIMESPEC2USEC(&contract->budget_max);
410 trimarchi 153
  mul32div32to32(MAX_BANDWIDTH,Q,T,server_list[current_server].Umax);
405 trimarchi 154
 
155
  T=TIMESPEC2USEC(&contract->period_max);
410 trimarchi 156
  server_list[current_server].Tmax=T;
405 trimarchi 157
 
158
  Q=TIMESPEC2USEC(&contract->budget_min);
410 trimarchi 159
  server_list[current_server].Cmin=Q;
405 trimarchi 160
 
410 trimarchi 161
  mul32div32to32(MAX_BANDWIDTH,Q,T,server_list[current_server].Umin);
162
  server_list[current_server].U=server_list[current_server].Umax;
221 giacomo 163
 
405 trimarchi 164
#ifdef FSF_DEBUG
410 trimarchi 165
  mul32div32to32(server_list[current_server].Umax,100, MAX_BANDWIDTH, temp);
405 trimarchi 166
  kern_printf("(Umax %d)",temp);
410 trimarchi 167
  mul32div32to32(server_list[current_server].Umin,100, MAX_BANDWIDTH, temp);
405 trimarchi 168
  kern_printf("(Umin %d)",temp);
169
#endif
170
 
171
 
410 trimarchi 172
  current_server++;
221 giacomo 173
  return 0;
174
 
175
}
176
 
177
int remove_contract(fsf_server_id_t server)
178
{
405 trimarchi 179
  int i=0;
180
  // find the contract
410 trimarchi 181
  while(i<current_server) {
405 trimarchi 182
     if (server_list[i].server==server) break;
183
     i++;
184
  }
221 giacomo 185
 
405 trimarchi 186
  // compress the array;
410 trimarchi 187
  while (i<(current_server-1)) {
405 trimarchi 188
     server_list[i].server=server_list[i+1].server;
189
     server_list[i].Umin=server_list[i+1].Umin;
406 giacomo 190
     server_list[i].U=server_list[i+1].Umax;    
405 trimarchi 191
     server_list[i].Umax=server_list[i+1].Umax;
192
     server_list[i].Cmin=server_list[i+1].Cmin;
193
     server_list[i].Tmax=server_list[i+1].Tmax;
194
     server_list[i].Qs=server_list[i+1].Qs;
195
     i++;
196
  }
410 trimarchi 197
  current_server--;
405 trimarchi 198
 
199
 
221 giacomo 200
  return 0;
201
 
202
}
203
 
204
 
205
int fsf_negotiate_contract
206
  (const fsf_contract_parameters_t *contract,
207
   fsf_server_id_t                 *server)
208
{
405 trimarchi 209
  SYS_FLAGS f;
210
  int i=0;
211
  TIME T;
212
  TIME Q;
221 giacomo 213
  /* Check if contract is initialized */
214
  if (!contract) return FSF_ERR_NOT_INITIALIZED;
215
 
216
  /* Admission Test */
217
  if (FSF_ADMISSION_TEST_IS_ENABLED)
218
    if (add_contract(contract))
219
      return FSF_ERR_CONTRACT_REJECTED;
405 trimarchi 220
  f = kern_fsave();
221 giacomo 221
 
241 giacomo 222
  /* SERVER => BUDGET */    
223
  set_SERVER_budget_from_contract(contract,server);
221 giacomo 224
 
225
  #ifdef FSF_DEBUG
226
    kern_printf("(New Server %d)",*server);
227
  #endif
228
 
405 trimarchi 229
  if (*server >= 0) {
221 giacomo 230
    link_contract_to_server(contract,*server);
406 giacomo 231
    if (recalculate_contract(fsf_max_bw)==-1)  {
405 trimarchi 232
       kern_frestore(f);
233
       return FSF_ERR_CREATE_SERVER;
234
    }
235
#ifdef  FSF_DEBUG
236
    kern_printf("(Adjust budget)");
237
#endif    
410 trimarchi 238
    for (i=0; i<current_server; i++) {
405 trimarchi 239
       mul32div32to32(MAX_BANDWIDTH,server_list[i].Cmin,server_list[i].U,T);
240
       #ifdef FSF_DEBUG
241
       kern_printf("(T %ld)", T);
242
       #endif
407 giacomo 243
       if (T<=server_list[i].Tmax) {
244
          server_list[i].actual_budget = server_list[i].Cmin;
245
          server_list[i].actual_period = T;
405 trimarchi 246
          adjust_SERVER_budget(server_list[i].server,server_list[i].Cmin, T);
407 giacomo 247
       } else {
405 trimarchi 248
         mul32div32to32(server_list[i].Tmax,server_list[i].U,MAX_BANDWIDTH,Q);
249
         #ifdef FSF_DEBUG
250
         kern_printf("(Q %ld)", Q);
251
         #endif
407 giacomo 252
         server_list[i].actual_budget = Q;
253
         server_list[i].actual_period = server_list[i].Tmax;
405 trimarchi 254
         adjust_SERVER_budget(server_list[i].server,Q, server_list[i].Tmax);
255
       }
409 trimarchi 256
         server_list[i].U=server_list[i].Umax;
405 trimarchi 257
 
258
    }
259
  }
260
  else  {
261
    kern_frestore(f);
221 giacomo 262
    return FSF_ERR_CREATE_SERVER;
405 trimarchi 263
  }
264
  kern_frestore(f);
265
 
221 giacomo 266
  return 0;
267
 
268
}
269
 
241 giacomo 270
int fsf_create_thread
271
  (fsf_server_id_t    server,
272
   pthread_t         *thread,
273
   pthread_attr_t    *attr,
274
   fsf_thread_code_t  thread_code,
275
   void              *arg,
276
   void              *local_scheduler_arg)
221 giacomo 277
{
278
 
279
  int local_scheduler_level,scheduler_id;
280
 
281
  #ifdef FSF_DEBUG 
267 giacomo 282
    kern_printf("(FSF:Insert thread = %d to Server = %d)",*thread,server);
221 giacomo 283
  #endif
284
 
285
  /* Check if server and thread exsist */
241 giacomo 286
  if (server == NIL)
287
    return FSF_ERR_INVALID_SERVER;
221 giacomo 288
 
241 giacomo 289
  local_scheduler_level = SERVER_get_local_scheduler_level_from_budget(fsf_server_level,server);
290
  scheduler_id = SERVER_get_local_scheduler_id_from_budget(fsf_server_level,server);
221 giacomo 291
 
292
  /* Check if thread is already bind */
293
  switch (scheduler_id) {
294
    case FSF_SCHEDULER_POSIX:
295
 
298 giacomo 296
      nrt_task_def_arg(*(NRT_TASK_MODEL *)(local_scheduler_arg),arg);
297
      nrt_task_def_level(*(NRT_TASK_MODEL *)(local_scheduler_arg),local_scheduler_level);
221 giacomo 298
 
298 giacomo 299
      *thread = task_create("POSIXSTAR", thread_code, local_scheduler_arg, NULL);
267 giacomo 300
      if (*thread == NIL) {
301
        #ifdef FSF_DEBUG
302
          kern_printf("(FSF:Error creating thread)");
303
        #endif
241 giacomo 304
        return FSF_ERR_CREATE_THREAD;
267 giacomo 305
      }
221 giacomo 306
 
241 giacomo 307
      POSIXSTAR_setbudget(local_scheduler_level, *thread, (int)(server));
234 giacomo 308
 
221 giacomo 309
    break;
310
    case FSF_SCHEDULER_EDF:
311
 
250 giacomo 312
      hard_task_def_arg(*(HARD_TASK_MODEL *)(local_scheduler_arg),arg);
313
      hard_task_def_level(*(HARD_TASK_MODEL *)(local_scheduler_arg),local_scheduler_level);
314
 
315
      *thread = task_create("EDFSTAR", thread_code, local_scheduler_arg, NULL);
316
      if (*thread == NIL)
317
        return FSF_ERR_CREATE_THREAD;
318
 
319
      EDFSTAR_setbudget(local_scheduler_level, *thread, (int)(server));
320
 
221 giacomo 321
      break;
235 giacomo 322
 
221 giacomo 323
    case FSF_SCHEDULER_RM:
235 giacomo 324
 
273 giacomo 325
      hard_task_def_arg(*(HARD_TASK_MODEL *)(local_scheduler_arg),arg);
326
      hard_task_def_level(*(HARD_TASK_MODEL *)(local_scheduler_arg),local_scheduler_level);
327
 
328
      *thread = task_create("RMSTAR", thread_code, local_scheduler_arg, NULL);
329
      if (*thread == NIL)
330
        return FSF_ERR_CREATE_THREAD;
331
 
332
      RMSTAR_setbudget(local_scheduler_level, *thread, (int)(server));
333
 
334
      break;
334 giacomo 335
    case FSF_SCHEDULER_MPEG:
336
 
337
      hard_task_def_arg(*(HARD_TASK_MODEL *)(local_scheduler_arg),arg);
338
      hard_task_def_level(*(HARD_TASK_MODEL *)(local_scheduler_arg),local_scheduler_level);
339
 
338 giacomo 340
      *thread = task_create("MPEGSTAR", thread_code, local_scheduler_arg, NULL);
334 giacomo 341
      if (*thread == NIL)
342
        return FSF_ERR_CREATE_THREAD;
343
 
344
      MPEGSTAR_setbudget(local_scheduler_level, *thread, (int)(server));
345
 
346
      break;
347
 
221 giacomo 348
    default:
241 giacomo 349
      return FSF_ERR_INVALID_SERVER;
221 giacomo 350
      break;
351
  }
352
 
353
  return 0;
354
 
355
}
356
 
357
int fsf_get_server
358
  (fsf_server_id_t *server,
359
   pthread_t       thread)
360
{
361
  int local_scheduler_level, scheduler_id;
362
 
241 giacomo 363
  local_scheduler_level = SERVER_get_local_scheduler_level_from_pid(fsf_server_level,thread);
364
  scheduler_id = SERVER_get_local_scheduler_id_from_pid(fsf_server_level, thread);
221 giacomo 365
 
366
  switch (scheduler_id) {
367
    case FSF_SCHEDULER_POSIX:  
368
      return POSIXSTAR_getbudget(local_scheduler_level,thread);
369
    case FSF_SCHEDULER_EDF:
235 giacomo 370
      return EDFSTAR_getbudget(local_scheduler_level,thread);
221 giacomo 371
    case FSF_SCHEDULER_RM:
235 giacomo 372
      return RMSTAR_getbudget(local_scheduler_level,thread);
334 giacomo 373
    case FSF_SCHEDULER_MPEG:
374
      return MPEGSTAR_getbudget(local_scheduler_level,thread);
235 giacomo 375
    default:
221 giacomo 376
      return -1;
377
  }
378
 
379
  return -1;
380
 
381
}
382
 
339 giacomo 383
int fsf_get_server_level(void)
384
{
385
 
386
  return fsf_server_level;
387
 
388
}
389
 
221 giacomo 390
int fsf_cancel_contract
391
  (fsf_server_id_t *server)
392
{
393
 
394
  int local_scheduler_level, scheduler_id;
411 trimarchi 395
  SYS_FLAGS f;
396
  TIME T,Q;
397
  int i=0;
221 giacomo 398
 
399
  #ifdef FSF_DEBUG
400
    kern_printf("(Remove server %d)",*server);
401
  #endif
402
 
403
  /* Check server id */
404
  if (*server < 0)
405
    return FSF_ERR_INVALID_SERVER;
406
 
241 giacomo 407
  local_scheduler_level = SERVER_get_local_scheduler_level_from_budget(fsf_server_level,*server);
408
  scheduler_id = SERVER_get_local_scheduler_id_from_budget(fsf_server_level,*server);
221 giacomo 409
 
410
  switch (scheduler_id) {
411
    case FSF_SCHEDULER_POSIX:
412
 
413
      /* Check if some thread use the server */
414
      if(POSIXSTAR_budget_has_thread(local_scheduler_level,*server))
415
        return FSF_ERR_SERVER_USED;
416
 
417
      break;
418
    case FSF_SCHEDULER_EDF:
235 giacomo 419
      /* Check if some thread use the server */
420
      if(EDFSTAR_budget_has_thread(local_scheduler_level,*server))
421
        return FSF_ERR_SERVER_USED;
422
      break;
423
 
221 giacomo 424
    case FSF_SCHEDULER_RM:
235 giacomo 425
      /* Check if some thread use the server */
426
      if(RMSTAR_budget_has_thread(local_scheduler_level,*server))
427
        return FSF_ERR_SERVER_USED;
428
 
221 giacomo 429
      break;
334 giacomo 430
 
431
    case FSF_SCHEDULER_MPEG:
432
      /* Check if some thread use the server */
433
      if(MPEGSTAR_budget_has_thread(local_scheduler_level,*server))
434
        return FSF_ERR_SERVER_USED;
435
 
436
      break;
437
 
221 giacomo 438
  }
439
 
241 giacomo 440
  SERVER_removebudget(fsf_server_level,*server);
221 giacomo 441
 
442
  level_free_descriptor(local_scheduler_level);
405 trimarchi 443
 
221 giacomo 444
  remove_contract(*server);
411 trimarchi 445
 
446
  f=kern_fsave();              
447
  if (recalculate_contract(fsf_max_bw)==-1)  {
448
       kern_frestore(f);
449
       return FSF_ERR_CREATE_SERVER;
450
  }
451
#ifdef  FSF_DEBUG
452
  kern_printf("(Adjust budget)");
453
#endif    
454
  for (i=0; i<current_server; i++) {
455
    mul32div32to32(MAX_BANDWIDTH,server_list[i].Cmin,server_list[i].U,T);
456
#ifdef FSF_DEBUG
457
    kern_printf("(T %ld)", T);
458
#endif
459
    if (T<=server_list[i].Tmax) {
460
      server_list[i].actual_budget = server_list[i].Cmin;
461
      server_list[i].actual_period = T;
462
      adjust_SERVER_budget(server_list[i].server,server_list[i].Cmin, T);
463
    } else {
464
      mul32div32to32(server_list[i].Tmax,server_list[i].U,MAX_BANDWIDTH,Q);
465
#ifdef FSF_DEBUG
466
      kern_printf("(Q %ld)", Q);
467
#endif
468
      server_list[i].actual_budget = Q;
469
      server_list[i].actual_period = server_list[i].Tmax;
470
      adjust_SERVER_budget(server_list[i].server,Q, server_list[i].Tmax);
471
    }
472
    server_list[i].U=server_list[i].Umax;
473
 
474
  }                                          
221 giacomo 475
 
405 trimarchi 476
 
221 giacomo 477
  *server = -1;
411 trimarchi 478
  kern_frestore(f);
221 giacomo 479
 
480
  return 0;
411 trimarchi 481
 
221 giacomo 482
}
483
 
405 trimarchi 484
int recalculate_contract(bandwidth_t U) {
485
  long int current_bandwidth,temp_U;
486
  int        Qt;
487
  int isok=0;
488
  int i=0;
489
 
407 giacomo 490
  #ifdef FSF_DEBUG
491
    int temp;
492
 
493
    kern_printf("(Recalculate contract)");
494
  #endif
405 trimarchi 495
 
496
  /* The current bandwidth is the min bandwidth */
497
  //current_bandwidth=SERVER_return_bandwidth(fsf_server_level);
498
  #ifdef FSF_DEBUG
410 trimarchi 499
     kern_printf("(nserver %d)", current_server);
405 trimarchi 500
  #endif  
501
 
502
  do  {
503
    current_bandwidth=0;
504
    Qt=0;
410 trimarchi 505
    for (i=0; i<current_server; i++) {
408 trimarchi 506
      if (server_list[i].Qs!=0 && server_list[i].U>server_list[i].Umin)
405 trimarchi 507
         Qt+=server_list[i].Qs;
508
       current_bandwidth+=server_list[i].U;
509
    }
510
 
511
    #ifdef FSF_DEBUG
512
    kern_printf("(Total Quality %d)", Qt);
513
    #endif
514
    isok=1;
410 trimarchi 515
    for (i=0; i<current_server; i++) {
408 trimarchi 516
      if (server_list[i].Qs!=0 && server_list[i].U>server_list[i].Umin) {
405 trimarchi 517
        temp_U=server_list[i].U;
518
        temp_U=temp_U-(current_bandwidth-U)*server_list[i].Qs/Qt;
407 giacomo 519
 
520
        if (temp_U<server_list[i].Umin) {
405 trimarchi 521
           server_list[i].U=server_list[i].Umin;
522
           isok=0;
523
        } else if (temp_U>=server_list[i].Umax)  {
524
           server_list[i].U=server_list[i].Umax;
525
        } else server_list[i].U=temp_U;
526
 
527
#ifdef FSF_DEBUG
528
        mul32div32to32(server_list[i].U,100, MAX_BANDWIDTH, temp);
529
        kern_printf("(Server %d bw %d)", server_list[i].server, temp);
530
#endif 
531
      }
532
    }  
533
 
534
  } while (!isok);
535
 
536
 return 0;
537
}
538
 
539
 
221 giacomo 540
int fsf_renegotiate_contract
541
  (const fsf_contract_parameters_t *new_contract,
542
   fsf_server_id_t server)
543
{
410 trimarchi 544
  SYS_FLAGS f;
545
  TIME T,Q;
546
  int i;
547
 
221 giacomo 548
  #ifdef FSF_DEBUG
549
    kern_printf("(Renegotiate for server %d)",server);
550
  #endif
551
 
552
  if (!new_contract)
553
    return FSF_ERR_NOT_INITIALIZED;
554
 
555
  if (server < 0)
556
    return FSF_ERR_INVALID_SERVER;
405 trimarchi 557
  // compute the new value
558
   f = kern_fsave();
410 trimarchi 559
   // change the parameter
560
   relink_contract_to_server(new_contract, server);
406 giacomo 561
   if (recalculate_contract(fsf_max_bw)==-1)  {
405 trimarchi 562
       kern_frestore(f);
563
       return FSF_ERR_CREATE_SERVER;
564
   }
406 giacomo 565
 
410 trimarchi 566
   for (i=0; i<current_server; i++) {
567
     mul32div32to32(MAX_BANDWIDTH,server_list[i].Cmin,server_list[i].U,T);
568
     #ifdef FSF_DEBUG
569
        kern_printf("(T %ld)", T);
570
     #endif
571
     if (T<=server_list[i].Tmax) {
572
       server_list[i].actual_budget = server_list[i].Cmin;
573
       server_list[i].actual_period = T;
574
       adjust_SERVER_budget(server_list[i].server,server_list[i].Cmin, T);
575
     } else {
576
       mul32div32to32(server_list[i].Tmax,server_list[i].U,MAX_BANDWIDTH,Q);
577
       #ifdef FSF_DEBUG
578
         kern_printf("(Q %ld)", Q);
579
       #endif
580
       server_list[i].actual_budget = Q;
581
       server_list[i].actual_period = server_list[i].Tmax;
582
       adjust_SERVER_budget(server_list[i].server,Q, server_list[i].Tmax);
583
     }
584
     server_list[i].U=server_list[i].Umax;
585
   }
405 trimarchi 586
   kern_frestore(f);
587
   return 0;
221 giacomo 588
}
241 giacomo 589
 
407 giacomo 590
void print_server_list()
591
{
592
 
593
  int i;
594
 
595
  kern_printf("Server List\n");
596
 
410 trimarchi 597
  for(i=0;i<current_server;i++) {
407 giacomo 598
 
599
    kern_printf("[%d] Q:%d T:%d\n",server_list[i].server,(int)server_list[i].actual_budget,(int)server_list[i].actual_period);
600
 
601
  }
602
 
603
}