SlideShare a Scribd company logo
1 of 135
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
OS


OS
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.

More Related Content

What's hot

AOS Lab 8: Interrupts and Device Drivers
AOS Lab 8: Interrupts and Device DriversAOS Lab 8: Interrupts and Device Drivers
AOS Lab 8: Interrupts and Device Drivers
Zubair Nabi
 

What's hot (20)

Contiki os timer tutorial
Contiki os timer tutorialContiki os timer tutorial
Contiki os timer tutorial
 
Kernel Recipes 2015 - Hardened kernels for everyone
Kernel Recipes 2015 - Hardened kernels for everyoneKernel Recipes 2015 - Hardened kernels for everyone
Kernel Recipes 2015 - Hardened kernels for everyone
 
MyShell - English
MyShell - EnglishMyShell - English
MyShell - English
 
Linux seccomp(2) vs OpenBSD pledge(2)
Linux seccomp(2) vs OpenBSD pledge(2)Linux seccomp(2) vs OpenBSD pledge(2)
Linux seccomp(2) vs OpenBSD pledge(2)
 
Alta disponibilidad en GNU/Linux
Alta disponibilidad en GNU/LinuxAlta disponibilidad en GNU/Linux
Alta disponibilidad en GNU/Linux
 
Pledge in OpenBSD
Pledge in OpenBSDPledge in OpenBSD
Pledge in OpenBSD
 
Kernel Recipes 2013 - Kernel for your device
Kernel Recipes 2013 - Kernel for your deviceKernel Recipes 2013 - Kernel for your device
Kernel Recipes 2013 - Kernel for your device
 
FreeBSD under DigitalOcean VPS
FreeBSD under DigitalOcean VPSFreeBSD under DigitalOcean VPS
FreeBSD under DigitalOcean VPS
 
AA-sort with SSE4.1
AA-sort with SSE4.1AA-sort with SSE4.1
AA-sort with SSE4.1
 
Linux Tracing Superpowers by Eugene Pirogov
Linux Tracing Superpowers by Eugene PirogovLinux Tracing Superpowers by Eugene Pirogov
Linux Tracing Superpowers by Eugene Pirogov
 
Checkpoint/Restore mostly in Userspace
Checkpoint/Restore mostly in UserspaceCheckpoint/Restore mostly in Userspace
Checkpoint/Restore mostly in Userspace
 
Exploiting the Linux Kernel via Intel's SYSRET Implementation
Exploiting the Linux Kernel via Intel's SYSRET ImplementationExploiting the Linux Kernel via Intel's SYSRET Implementation
Exploiting the Linux Kernel via Intel's SYSRET Implementation
 
The propeller
The propellerThe propeller
The propeller
 
AOS Lab 8: Interrupts and Device Drivers
AOS Lab 8: Interrupts and Device DriversAOS Lab 8: Interrupts and Device Drivers
AOS Lab 8: Interrupts and Device Drivers
 
Compromising Linux Virtual Machines with Debugging Mechanisms
Compromising Linux Virtual Machines with Debugging MechanismsCompromising Linux Virtual Machines with Debugging Mechanisms
Compromising Linux Virtual Machines with Debugging Mechanisms
 
Linux lv ms step by step
Linux lv ms step by stepLinux lv ms step by step
Linux lv ms step by step
 
Reusing your existing software on Android
Reusing your existing software on AndroidReusing your existing software on Android
Reusing your existing software on Android
 
D itg-manual
D itg-manualD itg-manual
D itg-manual
 
GOD MODE UNLOCKED - Hardware Backdoors in x86 CPUs
GOD MODE UNLOCKED - Hardware Backdoors in x86 CPUsGOD MODE UNLOCKED - Hardware Backdoors in x86 CPUs
GOD MODE UNLOCKED - Hardware Backdoors in x86 CPUs
 
Kernel crashdump
Kernel crashdumpKernel crashdump
Kernel crashdump
 

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

オペレーティングシステム 設計と実装 第3版(20101211)
オペレーティングシステム 設計と実装 第3版(20101211)オペレーティングシステム 設計と実装 第3版(20101211)
オペレーティングシステム 設計と実装 第3版(20101211)
Ryousei Takano
 
General Purpose Computing using Graphics Hardware
General Purpose Computing using Graphics HardwareGeneral Purpose Computing using Graphics Hardware
General Purpose Computing using Graphics Hardware
Daniel Blezek
 
Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...
Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...
Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...
Akihiro Hayashi
 

Similar to スケジューラからみたOSの話 (20)

オペレーティングシステム 設計と実装 第3版(20101211)
オペレーティングシステム 設計と実装 第3版(20101211)オペレーティングシステム 設計と実装 第3版(20101211)
オペレーティングシステム 設計と実装 第3版(20101211)
 
[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis[Ruxcon 2011] Post Memory Corruption Memory Analysis
[Ruxcon 2011] Post Memory Corruption Memory Analysis
 
General Purpose Computing using Graphics Hardware
General Purpose Computing using Graphics HardwareGeneral Purpose Computing using Graphics Hardware
General Purpose Computing using Graphics Hardware
 
“Linux Kernel CPU Hotplug in the Multicore System”
“Linux Kernel CPU Hotplug in the Multicore System”“Linux Kernel CPU Hotplug in the Multicore System”
“Linux Kernel CPU Hotplug in the Multicore System”
 
[Defcon] Hardware backdooring is practical
[Defcon] Hardware backdooring is practical[Defcon] Hardware backdooring is practical
[Defcon] Hardware backdooring is practical
 
TinyOS 2.1 Tutorial: TOSSIM
TinyOS 2.1 Tutorial: TOSSIMTinyOS 2.1 Tutorial: TOSSIM
TinyOS 2.1 Tutorial: TOSSIM
 
Pf: the OpenBSD packet filter
Pf: the OpenBSD packet filterPf: the OpenBSD packet filter
Pf: the OpenBSD packet filter
 
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...
Lec12 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- P6, Netbur...
 
[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis[CCC-28c3] Post Memory Corruption Memory Analysis
[CCC-28c3] Post Memory Corruption Memory Analysis
 
Hardware backdooring is practical : slides
Hardware backdooring is practical : slidesHardware backdooring is practical : slides
Hardware backdooring is practical : slides
 
Class 16: Making Loops
Class 16: Making LoopsClass 16: Making Loops
Class 16: Making Loops
 
lesson01.ppt
lesson01.pptlesson01.ppt
lesson01.ppt
 
RTOS on ARM cortex-M platform -draft
RTOS on ARM cortex-M platform -draftRTOS on ARM cortex-M platform -draft
RTOS on ARM cortex-M platform -draft
 
How Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protectionsHow Triton can help to reverse virtual machine based software protections
How Triton can help to reverse virtual machine based software protections
 
managing your network environment
managing your network environmentmanaging your network environment
managing your network environment
 
[HITB Malaysia 2011] Exploit Automation
[HITB Malaysia 2011] Exploit Automation[HITB Malaysia 2011] Exploit Automation
[HITB Malaysia 2011] Exploit Automation
 
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...
Python Brasil 2010 - Potter vs Voldemort - Lições ofidiglotas da prática Pyth...
 
Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...
Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...
Exploring Compiler Optimization Opportunities for the OpenMP 4.x Accelerator...
 
그래픽 최적화로 가...가버렷! (부제: 배치! 배칭을 보자!) , Batch! Let's take a look at Batching! -...
그래픽 최적화로 가...가버렷! (부제: 배치! 배칭을 보자!) , Batch! Let's take a look at Batching! -...그래픽 최적화로 가...가버렷! (부제: 배치! 배칭을 보자!) , Batch! Let's take a look at Batching! -...
그래픽 최적화로 가...가버렷! (부제: 배치! 배칭을 보자!) , Batch! Let's take a look at Batching! -...
 
Capturing NIC and Kernel TX and RX Timestamps for Packets in Go
Capturing NIC and Kernel TX and RX Timestamps for Packets in GoCapturing NIC and Kernel TX and RX Timestamps for Packets in Go
Capturing NIC and Kernel TX and RX Timestamps for Packets in Go
 

More from Takeshi Fujiwara (6)

2015圧縮ゼミ
2015圧縮ゼミ2015圧縮ゼミ
2015圧縮ゼミ
 
Scheduler2014
Scheduler2014Scheduler2014
Scheduler2014
 
Magic Ring Buffer
Magic Ring BufferMagic Ring Buffer
Magic Ring Buffer
 
Scheduler2012
Scheduler2012Scheduler2012
Scheduler2012
 
色を認識する仕組みと色空間
色を認識する仕組みと色空間色を認識する仕組みと色空間
色を認識する仕組みと色空間
 
身の回りの圧縮
身の回りの圧縮身の回りの圧縮
身の回りの圧縮
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 

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

  • 1. OS 2009.06.22 warawara@bug.co.jp
  • 2. kernel OS Windows XP NT kernel MacOS X mach CPU kernel CPU Process Thread Task
  • 7. MB CPU CPU CPU Cache, MMU, NUMA, Xen Core Core Core Core HT HT
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13. MS-DOS OS
  • 14.
  • 15.
  • 16.
  • 17.
  • 19.
  • 20.
  • 21. Windows 3.1 System7.0, MacOS8~9 PalmOS Protothreads μITRON
  • 22. non-preemptive Windows 1.0/2.x/3.x Windows 3.1 System7.0, MacOS8~9 PalmOS Switch-case Protothreads μITRON
  • 23.
  • 25.
  • 28.
  • 29.
  • 30.
  • 31. Windows 9x Windows NT MacOS X(mach) UNIX/Linux RTOS ...
  • 32. 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 ...
  • 33.
  • 34.
  • 35.
  • 36.
  • 37. ... ...
  • 38.
  • 43. ! ! ! ! ! ! ! ! ! !
  • 44. ! ! ! ! ! ! ! ! ! !
  • 45. ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
  • 46. ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !
  • 48. FIFO Task D Task D Task C Round Robin Task C Task B Task B Task A Task A
  • 49.
  • 50. I/O (nice )
  • 51. I/O I/O (nice ) I/O ( ) CPU
  • 52.
  • 53. Sem
  • 55. Sem Sem Sem
  • 56. Sem Sem Sem
  • 57. Sem VxWorks (1997) Sem Sem
  • 58.
  • 59.
  • 60.
  • 61. Non-preemptive kernel Preemptive kernel Preemptive kernel
  • 65.
  • 66. vs
  • 67. I/O vs ...
  • 68. Ready Queue vs CPU Ready Queue
  • 69. vs Kernel User MacOS X, BeOS, NeXTstep, ...
  • 70.
  • 71. (RTOS , Solaris) (Linux 2.2 ) IRQ (Linux 2.4, WindowsNT ) (Linux 2.6)
  • 72. (RTOS ) (Linux 2.2 ) IRQ (Linux 2.4, WindowsNT ) (Linux 2.6)
  • 73. (RTOS , Solaris) (Linux 2.2 ) IRQ (Linux 2.4, WindowsNT ) (Linux 2.6)
  • 74. (RTOS , Solaris) (Linux 2.2 ) IRQ (Linux 2.4, WindowsNT ) (Linux 2.6)
  • 75. (RTOS ) Linux2.4/Windows NT IRQ ( CPU ) (Linux 2.2 ) IRQ (Linux 2.4, WindowsNT ) (Linux 2.6)
  • 76. (RTOS ) IRQ CPU (Linux 2.2 ) IRQ ... IRQ (Linux 2.4, WindowsNT ) (Linux 2.6)
  • 77.
  • 78.
  • 79. 4.3BSD(SVR3) 1tick=10msec( ) ( ) =32 ( ) 4tick 100tick(1sec) I/O Ready
  • 80. 4.3BSD(SVR3) 1tick=10msec( ) ( ) =32 4tick 100tick(1sec) I/O Ready
  • 81. 4.3BSD(SVR3) 1tick=10msec( ) ( ) =32 0 127( ) 0 49 Kernel (Sleep ) 4tick 50 127 100tick(1sec) I/O Ready
  • 82. 4.3BSD(SVR3) 1tick=10msec( ) ( ) =32 CPU (tick ) 4tick (SVR3=0.5) 4.3BSD 100tick(1sec) I/O Ready
  • 83. 4.3BSD(SVR3) 1tick=10msec( ) ( ) =32 4tick Ready Queue 32 Queue 100tick(1sec)100msec (4.3BSD) Round Robin I/O Ready
  • 84. 4.3BSD(SVR3) 1tick=10msec( ) ( ) =32 1 4tick 100tick(1sec) I/O Ready
  • 85. WindowsNT 1tick=20msec Ready Queue(0 31)
  • 86. WindowsNT Windows9x 1tick=20msec 1tick=20msec Ready Queue(0 31)
  • 87. 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
  • 88. WindowsNT 1tick=20msec Ready Queue(0 31) 0 15 foreground (background ) ( 1 )
  • 89. WindowsNT 1tick=20msec Ready Queue(0 31) CPU( ) ( )
  • 90. SVR4 Ready (0 160) preemptive (mutex, )
  • 91. SVR4 Ready (0 160) preemptive (mutex, )
  • 92. SVR4 Ready (0 160) Round Robin preemptive (mutex, )
  • 93. SVR4 Ready 0 159( (0 ) 160) 0 59 60 99 preemptive 100 159 ※ (mutex, )
  • 94. SVR4 Ready (0 160) preemptive → → (mutex, → )
  • 95. SVR4 Ready (0 160) preemptive (mutex, )
  • 96. SVR4 Ready (0 160) CPU preemptive (mutex, )
  • 97. Solaris2.6 1tick=10msec( ) CPU Dispatch Queue LWP Preemptive
  • 98. Solaris2.6 SVR4 1tick=10msec( ) CPU Dispatch Queue LWP Preemptive
  • 99. 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
  • 100. Solaris2.6 1tick=10msec( ) LWP(Light Weight Process) CPU Dispatch Queue LWP Preemptive
  • 101. Solaris2.6 1tick=10msec( ) Non-preemption CPU Dispatch Queue thread_create() pause_cpus() LWP HAT, MMU Preemptive
  • 102. NORTi(μITRON4) 1tick=10msec(NORTi) (RealTime ) Ready FIFO (mutex)
  • 103. NORTi(μITRON4) 1tick=10msec(NORTi) (RealTime ) Ready FIFO (mutex)
  • 104. NORTi(μITRON4) 1tick=10msec(NORTi) (RealTime ) 1 Ready 31( ) ※ FIFO OS (mutex)
  • 105. NORTi(μITRON4) 1tick=10msec(NORTi) (RealTime ) Ready FIFO FIFO (mutex) Round Robin Ready Queue
  • 106. Linux 2.4 1tick=10msec( ) Ready Queue CPU
  • 107. Linux 2.4 1tick=10msec( ) 1 99( ) Ready Queue 200msec SCHED_FIFO SCHED_RR Round Robin SCHED_OTHER 4.3BSD CPU
  • 108. Linux 2.4 1 Ready Queue (goodness) CPU 1 1tick=10msec( ) goodness = 0 (1~99) goodness = 1000 + goodness = goodness 0 → Ready Queue CPU
  • 109. Linux 2.4 1tick=10msec( ) Ready Queue I/O I/O DB CPU CPU Non-preemptive
  • 110. Linux 2.6 1tick=1msec( ) ,CPU Ready Queue Preemptive Kernel CPU Active Queue Expire Queue
  • 111. Linux 2.6 1tick=1msec( ) v2.6.13 4msec BeOS 3msec ,CPU Ready Queue Preemptive Kernel CPU Active Queue Expire Queue
  • 112. Linux 2.6 SCHED_FIFO 1tick=1msec( ) ,CPU1 139( Ready Queue ) 1 99 Preemptive 100 139 Kernel CPU Active Queue Expire Queue
  • 113. 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
  • 114. 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
  • 115. 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
  • 116. 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
  • 117. 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
  • 118. 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
  • 119. Linux 2.6.23 CFS(Completely Fair Scheduler) Queue Queue Tree
  • 120. Linux 2.6.23 CFS(Completely Fair Scheduler) CPU CPU Queue Queue Tree
  • 121. Linux 2.6.23 CFS(Completely Fair Scheduler) Queue Queue Tree
  • 122. Linux 2.6.23 CFS(Completely Fair Scheduler) Queue Queue Tree
  • 123. 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
  • 124. 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
  • 125. 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
  • 126. 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
  • 127.
  • 128. I/O
  • 129. I/O I/O Queue Queue 4 Linux2.6
  • 130. I/O No Operation Queue
  • 131. I/O Complete Fairness Queueing ID 64 Round Robin
  • 132. I/O Deadline 4 Queue Queue Deadline Queue / Queue Deadline Queue Queue 500msec 5sec
  • 133. I/O Anticipatory 125msec 250msec I/O 7msec
  • 134. Q&A
  • 135. Fin.