Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1673 tullio 1
FSF demo for S.Ha.R.K
2
 
3
test1.c:
4
 
5
This demo shows the main feature of service contract implementation.
6
 
7
A set of 4 threads is created using the pthread standard functions.
8
At the beginning, these threads run without temporal restrictions
9
and they don't respect any deadline.
10
 
11
Two service contracts are initialized and set
12
 
13
fsf_initialize_contract(&contract1);
14
fsf_initialize_contract(&contract2);
15
fsf_set_contract_basic_parameters(&contract1,&budget1,&period1,NULL,NULL,FSF_DEFAULT_WORKLOAD);
16
fsf_set_contract_basic_parameters(&contract2,&budget2,&period2,NULL,NULL,FSF_DEFAULT_WORKLOAD);
17
 
18
whit the button 'q','w','e' you can respectively
19
negotiate contract for a server
20
 
21
[err = fsf_negotiate_contract(&contractX,&serverY);]
22
 
23
'q' -> negotiate contract1 for server1
24
'w' -> negotiate contract2 for server2
25
'e' -> negotiate contract1 for server3
26
 
27
now with button '1','2','3','4' you can bind the thread to a server
28
 
29
[err = fsf_bind_thread_to_server(serverY,jZ);]
30
 
31
'1' -> bind thread1 to server1
32
'2' -> bind thread2 to server2
33
'3' -> bind thread3 to server3
34
'4' -> bind thread4 to server2
35
 
36
threads will start to respect the assigned budget. It's possible
37
to bind more threads to one server. The local scheduler specified in the
38
contract define how the threads will get the server resources.
39
 
40
With '5','6','7','8' the thread is unbind from the server
41
 
42
[err = fsf_unbind_thread_from_server(jZ);]
43
 
44
With 'r','t','y' a server is removed
45
 
46
[err = fsf_cancel_contract(&server2);]
47
 
48