上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-cpuscheduling_Lec11

OPERATING SYSTEMS 1 龚玲 lgong@sjtu.edu.cn
OPERATING SYSTEMS 龚玲 lgong@sjtu.edu.cn 1

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

Solaris Scheduling class- global scheduling specific scheduler run priority order priorities classes queue highest first real time kernel threads of real-time LWPs system kernel service threads interactive kernel time sharing threads of interactive time-sharing LWPs lowest last
Solaris Scheduling

Solaris Dispatch Table time return time quantum from priority quantum expired sleep 0 200 0 50 5 200 0 50 10 160 0 51 15 160 5 51 20 120 10 52 25 120 15 52 30 80 20 53 35 80 25 54 40 40 30 55 45 40 35 56 50 40 40 58 55 40 45 58 59 20 49 59
Solaris Dispatch Table
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-cpuscheduling_Lec10.pdf
- 上海交通大学:《C++程序设计与实践》课程教学资源(课件讲稿)第2讲 C++语言的基本数据类型与表达式.pdf
- 上海交通大学:《C++程序设计与实践》课程教学资源(课件讲稿)第1讲 绪论.pdf
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源《面向对象软件工程实践指南》教材资料(WORD版).docx
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源(作业)面向对象软件工程实践指南-2.pdf
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源(作业)小组作业5-最终交付.docx
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源(作业)小组作业4.docx
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源(作业)小组作业3.docx
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源(作业)小组作业2.docx
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源(作业)小组作业1.docx
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源(作业)5.Test&Deploy&Close_软件验收报告.docx
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源(作业)5.Test&Deploy&Close_软件项目总结报告.docx
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源(作业)5.Test&Deploy&Close_软件测试计划.docx
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源(作业)5.Test&Deploy&Close_软件测试总结报告.docx
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源(作业)5.Test&Deploy&Close_用户手册.docx
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源(作业)5.Test&Deploy&Close_测试阶段指南.docx
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源(作业)5.Test&Deploy&Close_总结阶段指南.docx
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源(作业)5.Test&Deploy&Close_交付阶段指南.docx
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源(作业)5.Test&Deploy&Close_交付清单.docx
- 上海交通大学:《面向对象软件工程 Software Engineering》课程教学资源(作业)4. Build_模块开发卷宗.docx
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-deadlock_Lec15.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Introduction_Lec1.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Introduction_Lec2.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Introduction_Lec3.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec16_mainmemory.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec17_mainmemory.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec18_mainmemory.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec19_virtual memory.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec20_virtual memory.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec21_file system interface.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec22_file system implementation.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec23_file system implementation.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec24_DISK MANAGEMENT AND I/O.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Lec24_Review.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Process Synchronization_Lec12.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Process Synchronization_Lec13.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-Process Synchronization_Lec14.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-process_Lec4.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-process_Lec5.pdf
- 上海交通大学:《操作系统 Operating System》课程教学资源(课件讲稿)OS-process_Lec6.pdf