スケジューラからみたOSの話
Upcoming SlideShare
Loading in...5
×
 

スケジューラからみたOSの話

on

  • 3,137 views

2009新人ゼミ資料。

2009新人ゼミ資料。
スケジューラを切り口とした各種OSの話。広く浅く。

Statistics

Views

Total Views
3,137
Views on SlideShare
3,130
Embed Views
7

Actions

Likes
2
Downloads
21
Comments
0

3 Embeds 7

https://www.google.co.jp 5
https://twitter.com 1
http://cc.bingj.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

スケジューラからみたOSの話 スケジューラからみたOSの話 Presentation Transcript

  • OS 2009.06.22 warawara@bug.co.jp
  • kernel OS Windows XP NT kernel MacOS X mach CPU kernel CPU Process Thread Task
  • OS OS View slide
  • OS OS View slide
  • CPU CPU
  • CPU CPU
  • MB CPU CPU CPU Cache, MMU, NUMA, Xen Core Core Core Core HT HT
  • MS-DOS OS
  • Task A Task B Task B
  • Windows 3.1 System7.0, MacOS8~9 PalmOS Protothreads μITRON
  • non-preemptive Windows 1.0/2.x/3.x Windows 3.1 System7.0, MacOS8~9 PalmOS Switch-case Protothreads μITRON
  • Task A Task B Task B
  • Thread Manager(System7.5 )
  • Thread Manager(System7.5 ) Preemptive
  • Windows 9x Windows NT MacOS X(mach) UNIX/Linux RTOS ...
  • preemptive multitask Windows 95/98/Me Windows 9x Windows NT3.x/ 4.0/2000/Xp/Vista/7 Windows NT MacOS X(mach) SVR4, 4.4BSD, ... UNIX/Linux VxWorks, QNX, ThreadX, ... RTOS ...
  • ... ...
  • ! ! ! !
  • ! ! ! !
  • ! ! ! ! ! ! !
  • ! ! ! ! ! ! !
  • ! ! ! ! ! ! ! ! ! !
  • ! ! ! ! ! ! ! ! ! !
  • ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
  • ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
  • FIFO Round Robin
  • FIFO Task D Task D Task C Round Robin Task C Task B Task B Task A Task A
  • I/O (nice )
  • I/O I/O (nice ) I/O ( ) CPU
  • Sem
  • Sem Sem
  • Sem Sem Sem
  • Sem Sem Sem
  • Sem VxWorks (1997) Sem Sem
  • Non-preemptive kernel Preemptive kernel Preemptive kernel
  • Non-preemptive kernel
  • Preemptive kernel
  • Preemptive kernel SVR4
  • vs
  • I/O vs ...
  • Ready Queue vs CPU Ready Queue
  • vs Kernel User MacOS X, BeOS, NeXTstep, ...
  • (RTOS , Solaris) (Linux 2.2 ) IRQ (Linux 2.4, WindowsNT ) (Linux 2.6)
  • (RTOS ) (Linux 2.2 ) IRQ (Linux 2.4, WindowsNT ) (Linux 2.6)
  • (RTOS , Solaris) (Linux 2.2 ) IRQ (Linux 2.4, WindowsNT ) (Linux 2.6)
  • (RTOS , Solaris) (Linux 2.2 ) IRQ (Linux 2.4, WindowsNT ) (Linux 2.6)
  • (RTOS ) Linux2.4/Windows NT IRQ ( CPU ) (Linux 2.2 ) IRQ (Linux 2.4, WindowsNT ) (Linux 2.6)
  • (RTOS ) IRQ CPU (Linux 2.2 ) IRQ ... IRQ (Linux 2.4, WindowsNT ) (Linux 2.6)
  • 4.3BSD(SVR3) 1tick=10msec( ) ( ) =32 ( ) 4tick 100tick(1sec) I/O Ready
  • 4.3BSD(SVR3) 1tick=10msec( ) ( ) =32 4tick 100tick(1sec) I/O Ready
  • 4.3BSD(SVR3) 1tick=10msec( ) ( ) =32 0 127( ) 0 49 Kernel (Sleep ) 4tick 50 127 100tick(1sec) I/O Ready
  • 4.3BSD(SVR3) 1tick=10msec( ) ( ) =32 CPU (tick ) 4tick (SVR3=0.5) 4.3BSD 100tick(1sec) I/O Ready
  • 4.3BSD(SVR3) 1tick=10msec( ) ( ) =32 4tick Ready Queue 32 Queue 100tick(1sec)100msec (4.3BSD) Round Robin I/O Ready
  • 4.3BSD(SVR3) 1tick=10msec( ) ( ) =32 1 4tick 100tick(1sec) I/O Ready
  • WindowsNT 1tick=20msec Ready Queue(0 31)
  • WindowsNT Windows9x 1tick=20msec 1tick=20msec Ready Queue(0 31)
  • WindowsNT 1tick=20msec Ready 0 31( (0 ) 31) 0 15 16 31 (-2 +2) REALTIME_PRIORITY_CLASS 24 HIGH_PRIORITY_CLASS 13 NORMAL_PRIORITY_CLASS 7(background) or 9(foreground) IDLE_PRIORITY_CLASS 4
  • WindowsNT 1tick=20msec Ready Queue(0 31) 0 15 foreground (background ) ( 1 )
  • WindowsNT 1tick=20msec Ready Queue(0 31) CPU( ) ( )
  • SVR4 Ready (0 160) preemptive (mutex, )
  • SVR4 Ready (0 160) preemptive (mutex, )
  • SVR4 Ready (0 160) Round Robin preemptive (mutex, )
  • SVR4 Ready 0 159( (0 ) 160) 0 59 60 99 preemptive 100 159 ※ (mutex, )
  • SVR4 Ready (0 160) preemptive → → (mutex, → )
  • SVR4 Ready (0 160) preemptive (mutex, )
  • SVR4 Ready (0 160) CPU preemptive (mutex, )
  • Solaris2.6 1tick=10msec( ) CPU Dispatch Queue LWP Preemptive
  • Solaris2.6 SVR4 1tick=10msec( ) CPU Dispatch Queue LWP Preemptive
  • Solaris2.6 1tick=10msec( ) 0 169( ) 0 169( ) 60 99 CPU SYS(System) Dispatch Queue 0 59 TS(Time Share) , IA(Interactive) 100 159 RT(Realtime) 160 169 LWP Preemptive
  • Solaris2.6 1tick=10msec( ) LWP(Light Weight Process) CPU Dispatch Queue LWP Preemptive
  • Solaris2.6 1tick=10msec( ) Non-preemption CPU Dispatch Queue thread_create() pause_cpus() LWP HAT, MMU Preemptive
  • NORTi(μITRON4) 1tick=10msec(NORTi) (RealTime ) Ready FIFO (mutex)
  • NORTi(μITRON4) 1tick=10msec(NORTi) (RealTime ) Ready FIFO (mutex)
  • NORTi(μITRON4) 1tick=10msec(NORTi) (RealTime ) 1 Ready 31( ) ※ FIFO OS (mutex)
  • NORTi(μITRON4) 1tick=10msec(NORTi) (RealTime ) Ready FIFO FIFO (mutex) Round Robin Ready Queue
  • Linux 2.4 1tick=10msec( ) Ready Queue CPU
  • Linux 2.4 1tick=10msec( ) 1 99( ) Ready Queue 200msec SCHED_FIFO SCHED_RR Round Robin SCHED_OTHER 4.3BSD CPU
  • Linux 2.4 1 Ready Queue (goodness) CPU 1 1tick=10msec( ) goodness = 0 (1~99) goodness = 1000 + goodness = goodness 0 → Ready Queue CPU
  • Linux 2.4 1tick=10msec( ) Ready Queue I/O I/O DB CPU CPU Non-preemptive
  • Linux 2.6 1tick=1msec( ) ,CPU Ready Queue Preemptive Kernel CPU Active Queue Expire Queue
  • Linux 2.6 1tick=1msec( ) v2.6.13 4msec BeOS 3msec ,CPU Ready Queue Preemptive Kernel CPU Active Queue Expire Queue
  • Linux 2.6 SCHED_FIFO 1tick=1msec( ) ,CPU1 139( Ready Queue ) 1 99 Preemptive 100 139 Kernel CPU Active Queue Expire Queue
  • Linux 2.6 SCHED_FIFO 1tick=1msec( ) SCHED_RR Round Robin ,CPU Ready Queue (msec) 0~99 5 SCHED_OTHER 4.3BSD 100~199 4 SCHED_BAT Preemptive 200~299 3 300~399 2 Kernel CPU 400~499 1 500~599 0 Active Queue Expire Queue 600~699 -1 ... 900~999 -4 1sec -5
  • Linux 2.6 Bonus 800 139 (msec) ( ) Bonus=0 600 Bonus=10 126 400 113 200 0 100 100 113 126 139 100 113 126 139 Bonus Bonus 1 Bonus=0 Bonus=2 Bonus=5 Bonus=10 Bonus 0 100 113 126 139
  • Linux 2.6 O(1) Active Queue Expire Queue 100 Task A Task B Task C 100 101 Task D 101 102 Task E 102 103 103 ... ... 138 Task F 138 139 139 CPU
  • Linux 2.6 O(1) Active Queue Expire Queue 100 Task B Task C 100 Task A 101 Task D 101 102 Task E 102 103 103 ... ... 138 Task F 138 139 139 CPU
  • Linux 2.6 O(1) Active Queue Expire Queue 100 100 Task A Task B Task C 101 101 Task D 102 102 Task E 103 103 ... ... 138 138 Task F 139 139
  • Linux 2.6 O(1) Expire Queue Active Queue 100 100 Task A Task B Task C 101 101 Task D 102 102 Task E 103 103 ... ... 138 138 Task F 139 139
  • Linux 2.6.23 CFS(Completely Fair Scheduler) Queue Queue Tree
  • Linux 2.6.23 CFS(Completely Fair Scheduler) CPU CPU Queue Queue Tree
  • Linux 2.6.23 CFS(Completely Fair Scheduler) Queue Queue Tree
  • Linux 2.6.23 CFS(Completely Fair Scheduler) Queue Queue Tree
  • Xen bvt (borrowed virtual time) MB MB MB CPU sedf(Simple Early Deadline First) CPU CPU CPU CPU CPU credit Core Core Core Core Core Core Core Core Core Core Core Core HT HT HT HT HT HT
  • Xen bvt (borrowed virtual time) MB MB MB CPU sedf(Simple Early Deadline First) CPU CPU v3.0.2 CPU CPU CPU credit Core Core Core Core Core Core Core Core Core Core Core Core HT HT HT HT HT HT
  • Xen bvt (borrowed virtual time) MB MB MB CPU sedf(Simple Early Deadline First) CPU CPU CPU CPU CPU credit Core Core Core Core Core Core Core Core Core Core CPU Deadline Core Core Runnable Queue Wait Queue CPU HT HT HT HT bvt sedf SMP =CPU HT HT
  • Xen bvt (borrowed virtual time) MB MB MB CPU sedf(Simple Early Deadline First) CPU CPU CPU CPU CPU credit Core Core Core Core Core Core Core Core Core Core Core Core CPU Run Queue Run Queue HT HT credit credit CPU HT HT HT HT CPU credit UNDER credit OVER UNDER credit 10msec credit 0 weight
  • I/O
  • I/O I/O Queue Queue 4 Linux2.6
  • I/O No Operation Queue
  • I/O Complete Fairness Queueing ID 64 Round Robin
  • I/O Deadline 4 Queue Queue Deadline Queue / Queue Deadline Queue Queue 500msec 5sec
  • I/O Anticipatory 125msec 250msec I/O 7msec
  • Q&A
  • Fin.