Rev 1624 | Blame | Compare with Previous | Last modification | View Log | RSS feed
FSF demo for S.Ha.R.K
test1.c:
This demo shows the main feature of service contract implementation.
A set of 4 threads is created using the pthread standard functions.
At the beginning, these threads run without temporal restrictions
and they don't respect any deadline.
Two service contracts are initialized and set
fsf_initialize_contract(&contract1);
fsf_initialize_contract(&contract2);
fsf_set_contract_basic_parameters(&contract1,&budget1,&period1,NULL,NULL,FSF_DEFAULT_WORKLOAD);
fsf_set_contract_basic_parameters(&contract2,&budget2,&period2,NULL,NULL,FSF_DEFAULT_WORKLOAD);
whit the button 'q','w','e' you can respectively
negotiate contract for a server
[err = fsf_negotiate_contract(&contractX,&serverY);]
'q' -> negotiate contract1 for server1
'w' -> negotiate contract2 for server2
'e' -> negotiate contract1 for server3
now with button '1','2','3','4' you can bind the thread to a server
[err = fsf_bind_thread_to_server(serverY,jZ);]
'1' -> bind thread1 to server1
'2' -> bind thread2 to server2
'3' -> bind thread3 to server3
'4' -> bind thread4 to server2
threads will start to respect the assigned budget. It's possible
to bind more threads to one server. The local scheduler specified in the
contract define how the threads will get the server resources.
With '5','6','7','8' the thread is unbind from the server
[err = fsf_unbind_thread_from_server(jZ);]
With 'r','t','y' a server is removed
[err = fsf_cancel_contract(&server2);]