SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Process & CFS
Process
Process Program in the midst of execution How to create new process fork(), vfork() exec()
Data structure task_struct Process descriptor http://lxr.linux.no/linux+v2.6.39/include/linux/sched.h#L1193 Priority(prio, static_prio, normal_prio)  Scheduling class(sched_class) Scheduling policy(policy) Link parent, child, sibling, group_leader
Data structure thread_infohttp://lxr.linux.no/linux+v2.6.39/arch/arm/include/asm/thread_info.h#L50 Describe process data accessed by architecture specific code Difference among other CPUs Managed information task_struct flags for scheduling(TIF_SIGPANDING, TIF_NEED_RESCHED) cpu number (for multi processor) preempt_count
Data structure thread_unionhttp://lxr.linux.no/linux+v2.6.39/include/linux/sched.h#L2011 Kernel stack & thread_info 1 or 2 pages(8KB) Kernel stack size is less then 8K
Process states
Process creation system call  fork() Duplicate of the parent's page tables Create unique process descriptor for child(pidetc) Copy-on-Write Delay the copying pages exec() is called right after fork() vfork() Same as fork() except copying of parent page table Share parent's address space Child first scheme Parent is blocked until the child calls exec() or exits
do_fork() Start point of fork
copy_process()
 Thread Implementation threads as same as standard processes One thread has own task_struct pid/ tgid Create clone() system call clone(CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, 0); clone(SIGCHLD, 0); // fork() clone(CLONE_VFORK | CLONE_VM | SIGCHLD, 0); // vfork()
Kernel Threads Standard processes running in kernel space Do not have an address space(task_struct.mm is NULL) Schedulable, preemptable like normal process kthread_create() for creation
Process Termination exit() wait(), waitpid()
Scheduling
Scheduling CoopreativevsPreemptive  yield timeslice IO bound vs CPU bound Low latency vsHigh throughput
Process priority nice  Integer value(-20~19, default 0) High nice value correspond to low priority renice, setpriority() Realtime priority Always higher priority than normal processes Integer value(0~99)
Process priority Priority kernel internal Integer value (0~139) nice values[-20~19] are map to [100~139] [0~99] for realtime processes
Fairness scheduling RR on static timeslice 100ms(0 nice) vs 95ms(1 nice) 10ms(19 nice) vs 5ms (20 nice) A user’s 100 processes vs B user’s 1process Per user based scheduling Enable when kernel build Per thread level scheduling One nice value down gets 10% more CPU power vruntime(virtual clock) Support CGroupscheduling http://www.mjmwired.net/kernel/Documentation/scheduler/sched-design-CFS.txt
Overview schedule() Core T T T Ruequene do_fork() wake_up_new_task() T Tß T Waitqueue Core T Ruequene Core T T Ruequene Core T T Ruequene
tast_struct sched_class seched_entity sched_class Sched_entity load_weight on_rq vruntime rq load_weight cfs_rq rt_rq load_weight
CFS policy Soft real-time policy Posix standard Priority scheduling One nice level down gets 10% more CPU power Virtual clock Conceptual time considering priority Task waiting most of time will be scheduled to run Time order is managed by Runqueue
Data struct task_struct http://lxr.linux.no/linux+v2.6.39/include/linux/sched.h#L1193 SCHED_NORMAL SCHED_BATCH SCHED_IDLE SCHED_FIFO SCHED_RR
Data struct sched_class http://lxr.linux.no/linux+v2.6.39/include/linux/sched.h#L1056
Data struct rq http://lxr.linux.no/linux+v2.6.39/kernel/sched.c#L447
Data struct sched_entity http://lxr.linux.no/linux+v2.6.39/include/linux/sched.h#L1142
Dealing with priority Basic static_prio Value inherited by parent or set prio,normal_prio Dynamically changed
Dealing with priority Code
Computing Load weights load_weight
Remaining How to determine vruntime Process selection When schedule() function is called Context switching Sleep and Wake up Cgroup Hard to understand

Weitere ähnliche Inhalte

Was ist angesagt?

Systemd for developers
Systemd for developersSystemd for developers
Systemd for developersAlison Chaiken
 
Process management in linux
Process management in linuxProcess management in linux
Process management in linuxMazenetsolution
 
Process and Threads in Linux - PPT
Process and Threads in Linux - PPTProcess and Threads in Linux - PPT
Process and Threads in Linux - PPTQUONTRASOLUTIONS
 
Introduction to systemd
Introduction to systemdIntroduction to systemd
Introduction to systemdYusaku OGAWA
 
Perf stat windows
Perf stat windowsPerf stat windows
Perf stat windowsAccenture
 
LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager Alison Chaiken
 
USENIX ATC 2017 Performance Superpowers with Enhanced BPF
USENIX ATC 2017 Performance Superpowers with Enhanced BPFUSENIX ATC 2017 Performance Superpowers with Enhanced BPF
USENIX ATC 2017 Performance Superpowers with Enhanced BPFBrendan Gregg
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debuggingHao-Ran Liu
 
Tier 2 net app baseline design standard revised nov 2011
Tier 2 net app baseline design standard   revised nov 2011Tier 2 net app baseline design standard   revised nov 2011
Tier 2 net app baseline design standard revised nov 2011Accenture
 
Linux System Monitoring basic commands
Linux System Monitoring basic commandsLinux System Monitoring basic commands
Linux System Monitoring basic commandsMohammad Rafiee
 
Systemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to loveSystemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to loveAlison Chaiken
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelDivye Kapoor
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugginglibfetion
 
Process management in os
Process management in osProcess management in os
Process management in osMiong Lazaro
 

Was ist angesagt? (20)

systemd
systemdsystemd
systemd
 
Systemd for developers
Systemd for developersSystemd for developers
Systemd for developers
 
Process management in linux
Process management in linuxProcess management in linux
Process management in linux
 
Process and Threads in Linux - PPT
Process and Threads in Linux - PPTProcess and Threads in Linux - PPT
Process and Threads in Linux - PPT
 
Linux scheduler
Linux schedulerLinux scheduler
Linux scheduler
 
Introduction to systemd
Introduction to systemdIntroduction to systemd
Introduction to systemd
 
Basic of Systemd
Basic of SystemdBasic of Systemd
Basic of Systemd
 
Perf stat windows
Perf stat windowsPerf stat windows
Perf stat windows
 
LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager LISA15: systemd, the Next-Generation Linux System Manager
LISA15: systemd, the Next-Generation Linux System Manager
 
Linux kernel
Linux kernelLinux kernel
Linux kernel
 
USENIX ATC 2017 Performance Superpowers with Enhanced BPF
USENIX ATC 2017 Performance Superpowers with Enhanced BPFUSENIX ATC 2017 Performance Superpowers with Enhanced BPF
USENIX ATC 2017 Performance Superpowers with Enhanced BPF
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugging
 
Tier 2 net app baseline design standard revised nov 2011
Tier 2 net app baseline design standard   revised nov 2011Tier 2 net app baseline design standard   revised nov 2011
Tier 2 net app baseline design standard revised nov 2011
 
Linux System Monitoring basic commands
Linux System Monitoring basic commandsLinux System Monitoring basic commands
Linux System Monitoring basic commands
 
Systemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to loveSystemd: the modern Linux init system you will learn to love
Systemd: the modern Linux init system you will learn to love
 
LSA2 - 02 Namespaces
LSA2 - 02  NamespacesLSA2 - 02  Namespaces
LSA2 - 02 Namespaces
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugging
 
Linux monitoring
Linux monitoringLinux monitoring
Linux monitoring
 
Process management in os
Process management in osProcess management in os
Process management in os
 

Andere mochten auch

오픈 플랫폼 타이젠과 컨트리부션하기(연세대 오픈소스 미니콘서트)
오픈 플랫폼 타이젠과 컨트리부션하기(연세대 오픈소스 미니콘서트)오픈 플랫폼 타이젠과 컨트리부션하기(연세대 오픈소스 미니콘서트)
오픈 플랫폼 타이젠과 컨트리부션하기(연세대 오픈소스 미니콘서트)Yoonsoo Kim
 
Open Source Mini Concert-Session 3-Tizen
Open Source Mini Concert-Session 3-TizenOpen Source Mini Concert-Session 3-Tizen
Open Source Mini Concert-Session 3-TizenYoonsoo Kim
 
미디어오늘 저널리즘의미래 연결의 진화 - 매직에코 최형욱
미디어오늘 저널리즘의미래 연결의 진화 - 매직에코 최형욱미디어오늘 저널리즘의미래 연결의 진화 - 매직에코 최형욱
미디어오늘 저널리즘의미래 연결의 진화 - 매직에코 최형욱Hugh Choi 최형욱
 
Tizen introduction & architecture
Tizen introduction & architectureTizen introduction & architecture
Tizen introduction & architectureYoonsoo Kim
 
[Tizen Talk 2016 in Seoul] 바닥서부터 만들어보는 타이젠
[Tizen Talk 2016 in Seoul] 바닥서부터 만들어보는 타이젠[Tizen Talk 2016 in Seoul] 바닥서부터 만들어보는 타이젠
[Tizen Talk 2016 in Seoul] 바닥서부터 만들어보는 타이젠SangJung Woo
 
Internet of things : 세상의 모든것들이 연결되는 날 - 최형욱
 Internet of things : 세상의 모든것들이 연결되는 날 - 최형욱 Internet of things : 세상의 모든것들이 연결되는 날 - 최형욱
Internet of things : 세상의 모든것들이 연결되는 날 - 최형욱Hugh Choi 최형욱
 

Andere mochten auch (10)

Git & GitHub
Git & GitHubGit & GitHub
Git & GitHub
 
Syslog
SyslogSyslog
Syslog
 
Git & G
Git & GGit & G
Git & G
 
오픈 플랫폼 타이젠과 컨트리부션하기(연세대 오픈소스 미니콘서트)
오픈 플랫폼 타이젠과 컨트리부션하기(연세대 오픈소스 미니콘서트)오픈 플랫폼 타이젠과 컨트리부션하기(연세대 오픈소스 미니콘서트)
오픈 플랫폼 타이젠과 컨트리부션하기(연세대 오픈소스 미니콘서트)
 
Syslog
SyslogSyslog
Syslog
 
Open Source Mini Concert-Session 3-Tizen
Open Source Mini Concert-Session 3-TizenOpen Source Mini Concert-Session 3-Tizen
Open Source Mini Concert-Session 3-Tizen
 
미디어오늘 저널리즘의미래 연결의 진화 - 매직에코 최형욱
미디어오늘 저널리즘의미래 연결의 진화 - 매직에코 최형욱미디어오늘 저널리즘의미래 연결의 진화 - 매직에코 최형욱
미디어오늘 저널리즘의미래 연결의 진화 - 매직에코 최형욱
 
Tizen introduction & architecture
Tizen introduction & architectureTizen introduction & architecture
Tizen introduction & architecture
 
[Tizen Talk 2016 in Seoul] 바닥서부터 만들어보는 타이젠
[Tizen Talk 2016 in Seoul] 바닥서부터 만들어보는 타이젠[Tizen Talk 2016 in Seoul] 바닥서부터 만들어보는 타이젠
[Tizen Talk 2016 in Seoul] 바닥서부터 만들어보는 타이젠
 
Internet of things : 세상의 모든것들이 연결되는 날 - 최형욱
 Internet of things : 세상의 모든것들이 연결되는 날 - 최형욱 Internet of things : 세상의 모든것들이 연결되는 날 - 최형욱
Internet of things : 세상의 모든것들이 연결되는 날 - 최형욱
 

Ähnlich wie Linux Process & CF scheduling

Trap Handling in Linux
Trap Handling in LinuxTrap Handling in Linux
Trap Handling in LinuxYongraeJo
 
Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...Adrian Huang
 
Developing a Windows CE OAL.ppt
Developing a Windows CE OAL.pptDeveloping a Windows CE OAL.ppt
Developing a Windows CE OAL.pptKundanSingh887495
 
Profiling your Applications using the Linux Perf Tools
Profiling your Applications using the Linux Perf ToolsProfiling your Applications using the Linux Perf Tools
Profiling your Applications using the Linux Perf ToolsemBO_Conference
 
Intermediate Intel® Distribution of OpenVINO™ toolkit for Computer Vision Ap...
 Intermediate Intel® Distribution of OpenVINO™ toolkit for Computer Vision Ap... Intermediate Intel® Distribution of OpenVINO™ toolkit for Computer Vision Ap...
Intermediate Intel® Distribution of OpenVINO™ toolkit for Computer Vision Ap...kkaralek
 
Monitoring with Prometheus
Monitoring with PrometheusMonitoring with Prometheus
Monitoring with PrometheusShiao-An Yuan
 
Monitoring InfluxEnterprise
Monitoring InfluxEnterpriseMonitoring InfluxEnterprise
Monitoring InfluxEnterpriseInfluxData
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -evechiportal
 
計算機性能の限界点とその考え方
計算機性能の限界点とその考え方計算機性能の限界点とその考え方
計算機性能の限界点とその考え方Naoto MATSUMOTO
 
Containers: The What, Why, and How
Containers: The What, Why, and HowContainers: The What, Why, and How
Containers: The What, Why, and HowSneha Inguva
 
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
 
Hardware & Software Platforms for HPC, AI and ML
Hardware & Software Platforms for HPC, AI and MLHardware & Software Platforms for HPC, AI and ML
Hardware & Software Platforms for HPC, AI and MLinside-BigData.com
 
Clojure ♥ cassandra
Clojure ♥ cassandra Clojure ♥ cassandra
Clojure ♥ cassandra Max Penet
 
Interruption Timer Périodique
Interruption Timer PériodiqueInterruption Timer Périodique
Interruption Timer PériodiqueAnne Nicolas
 
Sedna XML Database: Executor Internals
Sedna XML Database: Executor InternalsSedna XML Database: Executor Internals
Sedna XML Database: Executor InternalsIvan Shcheklein
 
Optimizing InfluxDB Performance in the Real World by Dean Sheehan, Senior Dir...
Optimizing InfluxDB Performance in the Real World by Dean Sheehan, Senior Dir...Optimizing InfluxDB Performance in the Real World by Dean Sheehan, Senior Dir...
Optimizing InfluxDB Performance in the Real World by Dean Sheehan, Senior Dir...InfluxData
 
1032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.21032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.2Stanley Ho
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time OptimizationKan-Ru Chen
 

Ähnlich wie Linux Process & CF scheduling (20)

Trap Handling in Linux
Trap Handling in LinuxTrap Handling in Linux
Trap Handling in Linux
 
Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...
 
Developing a Windows CE OAL.ppt
Developing a Windows CE OAL.pptDeveloping a Windows CE OAL.ppt
Developing a Windows CE OAL.ppt
 
Unix kernal
Unix kernalUnix kernal
Unix kernal
 
Profiling your Applications using the Linux Perf Tools
Profiling your Applications using the Linux Perf ToolsProfiling your Applications using the Linux Perf Tools
Profiling your Applications using the Linux Perf Tools
 
Intermediate Intel® Distribution of OpenVINO™ toolkit for Computer Vision Ap...
 Intermediate Intel® Distribution of OpenVINO™ toolkit for Computer Vision Ap... Intermediate Intel® Distribution of OpenVINO™ toolkit for Computer Vision Ap...
Intermediate Intel® Distribution of OpenVINO™ toolkit for Computer Vision Ap...
 
Monitoring with Prometheus
Monitoring with PrometheusMonitoring with Prometheus
Monitoring with Prometheus
 
Monitoring InfluxEnterprise
Monitoring InfluxEnterpriseMonitoring InfluxEnterprise
Monitoring InfluxEnterprise
 
Track c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eveTrack c-High speed transaction-based hw-sw coverification -eve
Track c-High speed transaction-based hw-sw coverification -eve
 
計算機性能の限界点とその考え方
計算機性能の限界点とその考え方計算機性能の限界点とその考え方
計算機性能の限界点とその考え方
 
Containers: The What, Why, and How
Containers: The What, Why, and HowContainers: The What, Why, and How
Containers: The What, Why, and How
 
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...
 
Hardware & Software Platforms for HPC, AI and ML
Hardware & Software Platforms for HPC, AI and MLHardware & Software Platforms for HPC, AI and ML
Hardware & Software Platforms for HPC, AI and ML
 
Clojure ♥ cassandra
Clojure ♥ cassandra Clojure ♥ cassandra
Clojure ♥ cassandra
 
LINUX Device Drivers
LINUX Device DriversLINUX Device Drivers
LINUX Device Drivers
 
Interruption Timer Périodique
Interruption Timer PériodiqueInterruption Timer Périodique
Interruption Timer Périodique
 
Sedna XML Database: Executor Internals
Sedna XML Database: Executor InternalsSedna XML Database: Executor Internals
Sedna XML Database: Executor Internals
 
Optimizing InfluxDB Performance in the Real World by Dean Sheehan, Senior Dir...
Optimizing InfluxDB Performance in the Real World by Dean Sheehan, Senior Dir...Optimizing InfluxDB Performance in the Real World by Dean Sheehan, Senior Dir...
Optimizing InfluxDB Performance in the Real World by Dean Sheehan, Senior Dir...
 
1032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.21032 cs208 g operation system ip camera case share.v0.2
1032 cs208 g operation system ip camera case share.v0.2
 
Android Boot Time Optimization
Android Boot Time OptimizationAndroid Boot Time Optimization
Android Boot Time Optimization
 

Kürzlich hochgeladen

Uk-NO1 Amil In Karachi Best Amil In Karachi Bangali Baba In Karachi Aamil In ...
Uk-NO1 Amil In Karachi Best Amil In Karachi Bangali Baba In Karachi Aamil In ...Uk-NO1 Amil In Karachi Best Amil In Karachi Bangali Baba In Karachi Aamil In ...
Uk-NO1 Amil In Karachi Best Amil In Karachi Bangali Baba In Karachi Aamil In ...Amil baba
 
Aesthetic Design Inspiration by Slidesgo.pptx
Aesthetic Design Inspiration by Slidesgo.pptxAesthetic Design Inspiration by Slidesgo.pptx
Aesthetic Design Inspiration by Slidesgo.pptxsayemalkadripial4
 
Princess Jahan's Tuition Classes, a story for entertainment
Princess Jahan's Tuition Classes, a story for entertainmentPrincess Jahan's Tuition Classes, a story for entertainment
Princess Jahan's Tuition Classes, a story for entertainmentazuremorn
 
Zoom In Game for ice breaking in a training
Zoom In Game for ice breaking in a trainingZoom In Game for ice breaking in a training
Zoom In Game for ice breaking in a trainingRafik ABDI
 
Flying Avocado Cat Cryptocurrency Created, Coded, Generated and Named by Grok...
Flying Avocado Cat Cryptocurrency Created, Coded, Generated and Named by Grok...Flying Avocado Cat Cryptocurrency Created, Coded, Generated and Named by Grok...
Flying Avocado Cat Cryptocurrency Created, Coded, Generated and Named by Grok...TeslaStakeHolder
 
Fight Scene Storyboard (Action/Adventure Animation)
Fight Scene Storyboard (Action/Adventure Animation)Fight Scene Storyboard (Action/Adventure Animation)
Fight Scene Storyboard (Action/Adventure Animation)finlaygoodall2
 
What Life Would Be Like From A Different Perspective (saltyvixenstories.com)
What Life Would Be Like From A Different Perspective (saltyvixenstories.com)What Life Would Be Like From A Different Perspective (saltyvixenstories.com)
What Life Would Be Like From A Different Perspective (saltyvixenstories.com)Salty Vixen Stories & More
 
ECOLUXE pre-ESPYS Ultimate Sports Lounge 2024
ECOLUXE pre-ESPYS Ultimate Sports Lounge 2024ECOLUXE pre-ESPYS Ultimate Sports Lounge 2024
ECOLUXE pre-ESPYS Ultimate Sports Lounge 2024Durkin Entertainment LLC
 
A Spotlight on Darla Leigh Pittman Rodgers: Aaron Rodgers' Mother
A Spotlight on Darla Leigh Pittman Rodgers: Aaron Rodgers' MotherA Spotlight on Darla Leigh Pittman Rodgers: Aaron Rodgers' Mother
A Spotlight on Darla Leigh Pittman Rodgers: Aaron Rodgers' Motherget joys
 
Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand Finale
Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand FinaleBiswanath Byam Samiti Open Quiz 2022 by Qui9 Grand Finale
Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand FinaleQui9 (Ultimate Quizzing)
 
Taken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch DocumentTaken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch Documentf4ssvxpz62
 
办理滑铁卢大学毕业证成绩单|购买加拿大文凭证书
办理滑铁卢大学毕业证成绩单|购买加拿大文凭证书办理滑铁卢大学毕业证成绩单|购买加拿大文凭证书
办理滑铁卢大学毕业证成绩单|购买加拿大文凭证书zdzoqco
 
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...Amil Baba Dawood bangali
 
NO1 Certified Black magic specialist,Expert in Pakistan Amil Baba kala ilam E...
NO1 Certified Black magic specialist,Expert in Pakistan Amil Baba kala ilam E...NO1 Certified Black magic specialist,Expert in Pakistan Amil Baba kala ilam E...
NO1 Certified Black magic specialist,Expert in Pakistan Amil Baba kala ilam E...Amil Baba Dawood bangali
 
THE MEDIC, A STORY for entertainment.docx
THE MEDIC, A STORY for entertainment.docxTHE MEDIC, A STORY for entertainment.docx
THE MEDIC, A STORY for entertainment.docxazuremorn
 
Statement Of Intent - - Copy.documentfile
Statement Of Intent - - Copy.documentfileStatement Of Intent - - Copy.documentfile
Statement Of Intent - - Copy.documentfilef4ssvxpz62
 

Kürzlich hochgeladen (20)

Moveable Feast_Travel-Lifestyle-Culture Quiz.pptx
Moveable Feast_Travel-Lifestyle-Culture Quiz.pptxMoveable Feast_Travel-Lifestyle-Culture Quiz.pptx
Moveable Feast_Travel-Lifestyle-Culture Quiz.pptx
 
Uk-NO1 Amil In Karachi Best Amil In Karachi Bangali Baba In Karachi Aamil In ...
Uk-NO1 Amil In Karachi Best Amil In Karachi Bangali Baba In Karachi Aamil In ...Uk-NO1 Amil In Karachi Best Amil In Karachi Bangali Baba In Karachi Aamil In ...
Uk-NO1 Amil In Karachi Best Amil In Karachi Bangali Baba In Karachi Aamil In ...
 
Aesthetic Design Inspiration by Slidesgo.pptx
Aesthetic Design Inspiration by Slidesgo.pptxAesthetic Design Inspiration by Slidesgo.pptx
Aesthetic Design Inspiration by Slidesgo.pptx
 
Princess Jahan's Tuition Classes, a story for entertainment
Princess Jahan's Tuition Classes, a story for entertainmentPrincess Jahan's Tuition Classes, a story for entertainment
Princess Jahan's Tuition Classes, a story for entertainment
 
Zoom In Game for ice breaking in a training
Zoom In Game for ice breaking in a trainingZoom In Game for ice breaking in a training
Zoom In Game for ice breaking in a training
 
Flying Avocado Cat Cryptocurrency Created, Coded, Generated and Named by Grok...
Flying Avocado Cat Cryptocurrency Created, Coded, Generated and Named by Grok...Flying Avocado Cat Cryptocurrency Created, Coded, Generated and Named by Grok...
Flying Avocado Cat Cryptocurrency Created, Coded, Generated and Named by Grok...
 
Fight Scene Storyboard (Action/Adventure Animation)
Fight Scene Storyboard (Action/Adventure Animation)Fight Scene Storyboard (Action/Adventure Animation)
Fight Scene Storyboard (Action/Adventure Animation)
 
What Life Would Be Like From A Different Perspective (saltyvixenstories.com)
What Life Would Be Like From A Different Perspective (saltyvixenstories.com)What Life Would Be Like From A Different Perspective (saltyvixenstories.com)
What Life Would Be Like From A Different Perspective (saltyvixenstories.com)
 
ECOLUXE pre-ESPYS Ultimate Sports Lounge 2024
ECOLUXE pre-ESPYS Ultimate Sports Lounge 2024ECOLUXE pre-ESPYS Ultimate Sports Lounge 2024
ECOLUXE pre-ESPYS Ultimate Sports Lounge 2024
 
S10_E02_How to Pimp Social Media 101.pptx
S10_E02_How to Pimp Social Media 101.pptxS10_E02_How to Pimp Social Media 101.pptx
S10_E02_How to Pimp Social Media 101.pptx
 
A Spotlight on Darla Leigh Pittman Rodgers: Aaron Rodgers' Mother
A Spotlight on Darla Leigh Pittman Rodgers: Aaron Rodgers' MotherA Spotlight on Darla Leigh Pittman Rodgers: Aaron Rodgers' Mother
A Spotlight on Darla Leigh Pittman Rodgers: Aaron Rodgers' Mother
 
S10_E06-Sincerely,The Friday Club- Prelims Farewell Quiz.pptx
S10_E06-Sincerely,The Friday Club- Prelims Farewell Quiz.pptxS10_E06-Sincerely,The Friday Club- Prelims Farewell Quiz.pptx
S10_E06-Sincerely,The Friday Club- Prelims Farewell Quiz.pptx
 
Sincerely, The Friday Club - Farewell Quiz-Finals.pptx
Sincerely, The Friday Club - Farewell Quiz-Finals.pptxSincerely, The Friday Club - Farewell Quiz-Finals.pptx
Sincerely, The Friday Club - Farewell Quiz-Finals.pptx
 
Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand Finale
Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand FinaleBiswanath Byam Samiti Open Quiz 2022 by Qui9 Grand Finale
Biswanath Byam Samiti Open Quiz 2022 by Qui9 Grand Finale
 
Taken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch DocumentTaken Pilot Episode Story pitch Document
Taken Pilot Episode Story pitch Document
 
办理滑铁卢大学毕业证成绩单|购买加拿大文凭证书
办理滑铁卢大学毕业证成绩单|购买加拿大文凭证书办理滑铁卢大学毕业证成绩单|购买加拿大文凭证书
办理滑铁卢大学毕业证成绩单|购买加拿大文凭证书
 
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...
NO1 Certified kala ilam Expert In Peshwar Kala Jadu Specialist In Peshwar Kal...
 
NO1 Certified Black magic specialist,Expert in Pakistan Amil Baba kala ilam E...
NO1 Certified Black magic specialist,Expert in Pakistan Amil Baba kala ilam E...NO1 Certified Black magic specialist,Expert in Pakistan Amil Baba kala ilam E...
NO1 Certified Black magic specialist,Expert in Pakistan Amil Baba kala ilam E...
 
THE MEDIC, A STORY for entertainment.docx
THE MEDIC, A STORY for entertainment.docxTHE MEDIC, A STORY for entertainment.docx
THE MEDIC, A STORY for entertainment.docx
 
Statement Of Intent - - Copy.documentfile
Statement Of Intent - - Copy.documentfileStatement Of Intent - - Copy.documentfile
Statement Of Intent - - Copy.documentfile
 

Linux Process & CF scheduling

  • 3. Process Program in the midst of execution How to create new process fork(), vfork() exec()
  • 4. Data structure task_struct Process descriptor http://lxr.linux.no/linux+v2.6.39/include/linux/sched.h#L1193 Priority(prio, static_prio, normal_prio) Scheduling class(sched_class) Scheduling policy(policy) Link parent, child, sibling, group_leader
  • 5. Data structure thread_infohttp://lxr.linux.no/linux+v2.6.39/arch/arm/include/asm/thread_info.h#L50 Describe process data accessed by architecture specific code Difference among other CPUs Managed information task_struct flags for scheduling(TIF_SIGPANDING, TIF_NEED_RESCHED) cpu number (for multi processor) preempt_count
  • 6. Data structure thread_unionhttp://lxr.linux.no/linux+v2.6.39/include/linux/sched.h#L2011 Kernel stack & thread_info 1 or 2 pages(8KB) Kernel stack size is less then 8K
  • 8. Process creation system call fork() Duplicate of the parent's page tables Create unique process descriptor for child(pidetc) Copy-on-Write Delay the copying pages exec() is called right after fork() vfork() Same as fork() except copying of parent page table Share parent's address space Child first scheme Parent is blocked until the child calls exec() or exits
  • 11. Thread Implementation threads as same as standard processes One thread has own task_struct pid/ tgid Create clone() system call clone(CLONE_VM | CLONE_FS | CLONE_FILES | CLONE_SIGHAND, 0); clone(SIGCHLD, 0); // fork() clone(CLONE_VFORK | CLONE_VM | SIGCHLD, 0); // vfork()
  • 12. Kernel Threads Standard processes running in kernel space Do not have an address space(task_struct.mm is NULL) Schedulable, preemptable like normal process kthread_create() for creation
  • 13. Process Termination exit() wait(), waitpid()
  • 15. Scheduling CoopreativevsPreemptive yield timeslice IO bound vs CPU bound Low latency vsHigh throughput
  • 16. Process priority nice Integer value(-20~19, default 0) High nice value correspond to low priority renice, setpriority() Realtime priority Always higher priority than normal processes Integer value(0~99)
  • 17. Process priority Priority kernel internal Integer value (0~139) nice values[-20~19] are map to [100~139] [0~99] for realtime processes
  • 18. Fairness scheduling RR on static timeslice 100ms(0 nice) vs 95ms(1 nice) 10ms(19 nice) vs 5ms (20 nice) A user’s 100 processes vs B user’s 1process Per user based scheduling Enable when kernel build Per thread level scheduling One nice value down gets 10% more CPU power vruntime(virtual clock) Support CGroupscheduling http://www.mjmwired.net/kernel/Documentation/scheduler/sched-design-CFS.txt
  • 19. Overview schedule() Core T T T Ruequene do_fork() wake_up_new_task() T Tß T Waitqueue Core T Ruequene Core T T Ruequene Core T T Ruequene
  • 20. tast_struct sched_class seched_entity sched_class Sched_entity load_weight on_rq vruntime rq load_weight cfs_rq rt_rq load_weight
  • 21. CFS policy Soft real-time policy Posix standard Priority scheduling One nice level down gets 10% more CPU power Virtual clock Conceptual time considering priority Task waiting most of time will be scheduled to run Time order is managed by Runqueue
  • 22. Data struct task_struct http://lxr.linux.no/linux+v2.6.39/include/linux/sched.h#L1193 SCHED_NORMAL SCHED_BATCH SCHED_IDLE SCHED_FIFO SCHED_RR
  • 23. Data struct sched_class http://lxr.linux.no/linux+v2.6.39/include/linux/sched.h#L1056
  • 24. Data struct rq http://lxr.linux.no/linux+v2.6.39/kernel/sched.c#L447
  • 25. Data struct sched_entity http://lxr.linux.no/linux+v2.6.39/include/linux/sched.h#L1142
  • 26. Dealing with priority Basic static_prio Value inherited by parent or set prio,normal_prio Dynamically changed
  • 28. Computing Load weights load_weight
  • 29. Remaining How to determine vruntime Process selection When schedule() function is called Context switching Sleep and Wake up Cgroup Hard to understand

Hinweis der Redaktion

  1. wake_up_new_task; in other words, the task structure is added to the scheduler queue뒤쪽에서 스케줄링에서 설명하겠지만 생성된 프로세스는 무조건 한번은 수행되도록 보장함
  2. Check flag – for clone system call parameterDup_task_struct – 실제 복사가 이루어짐Sched_fork – 스케줄링에 관련된 내용이 복사됨(확인요함)
  3. Vruntime – 실제 수행된 시간에 prority별로 가중치를 둔 이후, 가장 수행시간이 적은 task 위주로 수행함
  4. Prio, normal_proi – 동적으로 변함Static_proi- 고정됨Rt_prioroty – realtime인 경우만설정, 그렇지 않은 경우 0,max 99Sched_entity를 갖는 것은 모든지 스케줄링이 될 수 있음Policy는 cpu에 동작할 때의 정책 –sched_normalCpus_allows – bitfield로 특정 cpu에서 동작하는 것을 제한Tile_slice for realtimeß
  5. Nr_running – 현재 큐에 들어있는 태스크 갯수Load – 가중치를 고려한 테스크의 워크로드Clock은 해당 런큐가 주기적으로 스케줄링을 받도록 계산하기 위하여 사용됨Cpu_load는 이전의 워크로드를 기록 – 로드벨런싱, 그룹핑에 쓰임\\
  6. 전체 큐의 워크로드런큐 내부적으로 rb를 이용하기 때문에, 그에 필요한 노드On_rq – 현재 스케줄링이 되고 있는지 확인CFS를 구현하기 위하여 필요한 시간 값Task_struct가 sched_entity를 가지고 있기 때문에 스케줄링을 받을 수 있음
  7. weight는 load 즉, 우선순위에 대한 가중치이고 inv_weight는 이의 역수(1/weight)에 해당하는 값이다.weight 값은 nice를 통해 지정할 수 있는 우선순위에 대응하는 값이며 (nice level 0일 때: 1024)sched.c 파일의 prio_to_weight[] 배열에 저장되어 있다.참고로 nice (우선순위) 값의 1 차이는 weight 값의 1.25 배 차이이며이는 프로세스가 CPU를 사용하는 시간에 10% 정도 영향을 준다.inv_weight값은 단지 계산을 간편하게 하기 위한 목적으로 도입된 것으로가중치 계산을 위한 나눗셈을 피하기 위해 미리 정해진 충분히 큰 수(2^32)에 나눗셈을 미리 계산해 둔 값이다.