Chapter 5:CPU Scheduling o Basic Concepts o Scheduling Criteria o Scheduling Algorithms o Real-Time Scheduling o Thread Scheduling o Operating Systems Examples o Java Thread Scheduling o Algorithm Evaluation
Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Real-Time Scheduling Thread Scheduling Operating Systems Examples Java Thread Scheduling Algorithm Evaluation
REVIEW o Basic Concepts o Scheduling Criteria o Scheduling Algorithms ohttp://wenku.baidu.com/course/study/77fldcccda38376ba flfae94#665ea0c7aa00b52acfc7ca94
REVIEW Basic Concepts Scheduling Criteria Scheduling Algorithms http://wenku.baidu.com/course/study/77f1dcccda38376ba f1fae94#665ea0c7aa00b52acfc7ca94
Goals for today o Real-Time Scheduling o Thread Scheduling o Operating Systems Examples o Java Thread Scheduling o Algorithm Evaluation
Goals for today Real-Time Scheduling Thread Scheduling Operating Systems Examples Java Thread Scheduling Algorithm Evaluation
Real-Time Scheduling o Hard real-time systems-required to complete a critical task within a guaranteed amount of time o Soft real-time computing requires that critical processes receive priority over less fortunate ones
Real-Time Scheduling Hard real-time systems – required to complete a critical task within a guaranteed amount of time Soft real-time computing – requires that critical processes receive priority over less fortunate ones
Thread Scheduling o Local Scheduling-How the threads library decides which thread to put onto an available LWP o Global Scheduling-How the kernel decides which kernel thread to run next
Thread Scheduling Local Scheduling – How the threads library decides which thread to put onto an available LWP Global Scheduling – How the kernel decides which kernel thread to run next
Pthread Scheduling APl int main(int argc,char *argv[]) int i,scope; pthread-t tid[NUM-THREADS]; pthread attrt attr; /get the default attributes * pthread_attr init(&attr); /first inquire on the current scope * if (pthread_attr_getscope(attr,&scope)!=0) fprintf(stderr,"Unable to get scheduling scope\n"); elsef if (scope =PTHREAD_SCOPE_PROCESS) printf("PTHREAD_SCOPE PROCESS"); else if (scope =PTHREAD_SCOPE _SYSTEM) printf("PTHREAD_SCOPE_SYSTEM"); else fprintf(stderr,"Illegal scope value.\n"); /set the scheduling algorithm to PCS or SCS * pthread_attr_setscope(&attr,PTHREAD_SCOPE_SYSTEM); /create the threads * for (i 0;i NUM_THREADS;i++) pthread_create(tid[i],&attr,runner,NULL); /now join on each thread * for (i=0;i<NUM_THREADS;i++) pthread_join(tid[i],NULL); /Each thread will begin control in this function * void *runner(void *param) /do some work ..* pthread_exit(0);
Pthread Scheduling API
Operating System Examples o Solaris scheduling o Windows XP scheduling o Linux scheduling
Operating System Examples Solaris scheduling Windows XP scheduling Linux scheduling