Linux Task Scheduling

Size: px
Start display at page:

Download "Linux Task Scheduling"

Transcription

1 Linux Task Scheduling Hyunmin Yoon

2 2 This document is based-on linux version (released at ) 2

3 3 Task Scheduling SCHEDULING CLASS 3

4 4 Scheduling Class Since kernel, the Linux scheduler has been made modular The modularity is called scheduler classes Scheduler classes enable different, pluggable algorithms to coexist, scheduling their own types of processes Each scheduler class has a priority The base scheduler code iterates over each scheduler class in order of priority Base Scheduler kernel/sched.c RT scheduler Deadline scheduler CFS scheduler Idle-task scheduler Custom scheduler 4

5 5 Scheduling Class Each task belongs to one specific scheduling class Class Description Policy dl_sched_class for real-time task with deadline SCHED_DEADLINE rt_sched_class fair_sched_class for real-time task for time-sharing task SCHED_FIFO SCHED_RR SCHED_NORMAL SCHED_BATCH idle_sched_class for tasks that avoid to disturb other tasks SCHED_IDLE Each scheduling class is linked with one another in a singly linked list, allowing the classes to be iterated sched_class_highest stop_sched_class.next dl_sched_class.next rt_sched_class.next fair_sched_class.next idle_sched_class.next = NULL 5

6 6 Functions in Scheduling Class Function Operations enqueue_task Put the task into the runqueue dequeue_task Remove the task from the runqueue pick_next_task Choose the most appropriated task eligible to run next put_prev_task Return previous (current) task on the runqueue set_curr_task Set the current task for a given CPU task_tick Do periodic work for scheduling (it is invoked by timer) 6

7 7 Time Sharing Scheduling Class <kernel/sched/fair.c> const struct sched_class fair_sched_class =.next.enqueue_task.dequeue_task.yield_task.yield_to_task.check_preempt_curr.pick_next_task.put_prev_task #ifdef CONFIG_SMP.select_task_rq.migrate_task_rq.rq_online.rq_offline = &idle_sched_class, = enqueue_task_fair, = dequeue_task_fair, = yield_task_fair, = yield_to_task_fair, = check_preempt_wakeup, = pick_next_task_fair, = put_prev_task_fair, = select_task_rq_fair, = migrate_task_rq_fair, = rq_online_fair, = rq_offline_fair, The next class is Idle scheduling class <include/linux/sched.h> struct task_struct const struct sched_class *sched_class; struct sched_entity se; struct sched_rt_entity rt; #endif.task_waking.task_dead.set_cpus_allowed = task_waking_fair, = task_dead_fair, = set_cpus_allowed_common, Scheduling class for this task.set_curr_task.task_tick.task_fork = set_curr_task_fair, = task_tick_fair, = task_fork_fair,.prio_changed.switched_from.switched_to = prio_changed_fair, = switched_from_fair, = switched_to_fair,.get_rr_interval = get_rr_interval_fair,.update_curr = update_curr_fair, #ifdef CONFIG_FAIR_GROUP_SCHED.task_move_group #endif ; = task_move_group_fair, 7

8 8 How to Change Scheduling Class (1) <include/uapi/linux/sched/types.h> struct sched_attr u32 size; <example codes> #define NR_sched_setattr 314 #define SCHED_DEADLINE 6 ; u32 sched_policy; u64 sched_flags; /* SCHED_NORMAL, SCHED_BATCH */ s32 sched_nice; /* SCHED_FIFO, SCHED_RR */ u32 sched_priority; /* SCHED_DEADLINE */ u64 sched_runtime; u64 sched_deadline; u64 sched_period; int sched_setattr(pid_t pid, const struct sched_attr *attr, unsigned int flags) return syscall( NR_sched_setattr, pid, attr, flags); int main(int argc, char** argv)... memset(&attr, 0, sizeof(struct sched_attr)); attr.size = sizeof(attr); attr.sched_policy = SCHED_DEADLINE; attr.sched_runtime = 1000; attr.sched_deadline = 10000; attr.sched_period = 10000; <include/uapi/linux/sched.h> /* * Scheduling policies */ #define SCHED_NORMAL 0 #define SCHED_FIFO 1 #define SCHED_RR 2 #define SCHED_BATCH 3 /* SCHED_ISO: reserved but not implemented yet */ #define SCHED_IDLE 5 #define SCHED_DEADLINE 6 ret = sched_setattr(getpid(), &attr, flags); if (ret!= 0) perror("sched_setattr"); exit(1);... return 0; 8

9 9 How to Change Scheduling Class (2) sys_sched_setattr Kernel level sched_setattr() sched_setscheduler() * setscheduler() * <kernel/sched/core.c: sched_setscheduler()> if (queued) dequeue_task(rq, p, queue_flags); if (running) put_prev_task(rq, p); prev_class = p->sched_class; setscheduler(rq, p, attr, pi); if (queued) if (running) /* * We enqueue to tail when the priority of a task is * increased (user space view). */ if (oldprio < p->prio) queue_flags = ENQUEUE_HEAD; enqueue_task(rq, p, queue_flags); set_curr_task(rq, p); check_class_changed(rq, p, prev_class, oldprio); <kernel/sched/core.c> static void setscheduler(struct rq *rq, struct task_struct *p, const struct sched_attr *attr, bool keep_boost) setscheduler_params(p, attr); <kernel/sched/core.c> /* * Keep a potential priority boosting if called from * sched_setscheduler(). */ p->prio = normal_prio(p); if (keep_boost) p->prio = rt_effective_prio(p, p->prio); if (dl_prio(p->prio)) p->sched_class = &dl_sched_class; else if (rt_prio(p->prio)) p->sched_class = &rt_sched_class; else p->sched_class = &fair_sched_class; static inline void check_class_changed(struct rq *rq, struct task_struct *p, const struct sched_class *prev_class, int oldprio) if (prev_class!= p->sched_class) if (prev_class->switched_from) prev_class->switched_from(rq, p); p->sched_class->switched_to(rq, p); else if (oldprio!= p->prio dl_task(p)) p->sched_class->prio_changed(rq, p, oldprio); 9

10 10 Task Scheduling TASK 10

11 11 Linux Process Descriptor (Robert Love, Linux Kernel Development 3 rd Edition) It is an element of the task list It has type struct task_struct struct task_struct is defined in <linux/shched.h> It contains all the information that the kernel has and needs about a process 11

12 12 Linux Process States (Robert Love, Linux Kernel Development 3 rd Edition) 12

13 13 Linux Process State Flags Flags Description TASK_RUNNING The process is runnable; it is either currently running or on a runqueue waiting to run. TASK_INTERRUPTIBLE The process is sleeping, waiting for some condition to exist. When this condition exists, the kernel sets the process s state to TASK_RUNNING. The process also awakes prematurely and becomes runnable if it receives a signal. TASK_UNINTERRUPTIBLE This state is identical to TASK_INTERRUPTIBLE except that it does not wake up and become runnable if it receives a signal. <include/linux/sched.h> <include/linux/sched.h> /* Used in tsk->state: */ #define TASK_RUNNING #define TASK_INTERRUPTIBLE #define TASK_UNINTERRUPTIBLE #define set_task_state(tsk, state_value) #define set_task_state(tsk, state_value) #define set_current_state(state_value) #define set_current_state(state_value) 0x0000 0x0001 0x0002 struct task_struct volatile long state; 13

14 14 Task and Schedulable Entity <include/linux/sched.h> struct task_struct volatile long state; void *stack; atomic_t usage; unsigned int flags; unsigned int ptrace; #ifdef CONFIG_SMP struct llist_node wake_entry; int on_cpu; unsigned int wakee_flips; unsigned long wakee_flip_decay_ts; struct task_struct *last_wakee; #endif int wake_cpu; int on_rq; int prio, static_prio, normal_prio; unsigned int rt_priority; const struct sched_class *sched_class; struct sched_entity se; struct sched_rt_entity rt; #ifdef CONFIG_CGROUP_SCHED struct task_group *sched_task_group; #endif struct sched_dl_entity dl; <include/linux/sched.h> struct sched_entity struct load_weight /* for load-balancing */ struct rb_node struct list_head unsigned int u64 u64 u64 u64 u64 #ifdef CONFIG_SCHEDSTATS struct sched_statistics statistics; #endif load; run_node; group_node; on_rq; exec_start; sum_exec_runtime; vruntime; prev_sum_exec_runtime; nr_migrations; #ifdef CONFIG_FAIR_GROUP_SCHED int depth; struct sched_entity *parent; /* rq on which this entity is (to be) queued: */ struct cfs_rq *cfs_rq; /* rq "owned" by this entity/group: */ struct cfs_rq *my_q; #endif #ifdef CONFIG_SMP /* Per entity load average tracking */ struct sched_avg avg; #endif ; Schedulable entity, it includes all the information to schedule this task 14

15 15 Task Scheduling RUNQUEUE 15

16 16 Global vs. Partitioned Scheduling Global Scheduling Partitioned Scheduling 16

17 17 CPU Runqueue < kernel/sched/sched.h > <kernel/sched/sched.h> /* * This is the main, per-cpu runqueue data structure. * * Locking rule: those places that want to lock multiple runqueues * (such as the load balancing or the thread migration code), lock * acquire operations must be ordered by ascending &runqueue. */ struct rq /* runqueue lock: */ raw_spinlock_t lock; /* CFS-related fields in a runqueue */ struct cfs_rq struct rb_root tasks_timeline; struct sched_entity *curr, *next, *last, *skip; struct rq *rq; ; unsigned int nr_running; /* capture load from *all* tasks on this cpu: */ struct load_weight load; unsigned long nr_load_updates; u64 nr_switches; ; struct cfs_rq cfs; struct rt_rq rt; struct dl_rq dl; struct task_struct *curr, *idle, *stop; CFS runqueue info. Real-time scheduling class (FIFO and RR) runqueue info. Deadline scheduling class runqueue info. A task for Idle scheduling class A task that is running and is currently allocated CPU 17

18 18 Runqueue for Real-time Scheduling Class <kernel/sched/sched.h> /* Real-Time classes' related field in a runqueue: */ struct rt_rq struct rt_prio_array active; unsigned int rt_nr_running; ; Runqueue for Real-time scheduling class /* * This is the priority-queue data structure of the RT scheduling class: */ struct rt_prio_array DECLARE_BITMAP(bitmap, MAX_RT_PRIO+1); struct list_head queue[max_rt_prio]; ; <include/linux/sched.h> struct sched_rt_entity struct list_head run_list; unsigned long timeout; unsigned long watchdog_stamp; unsigned int time_slice; struct sched_rt_entity *back; #ifdef CONFIG_RT_GROUP_SCHED struct sched_rt_entity *parent; /* rq on which this entity is (to be) queued: */ #endif ; struct rt_rq *rt_rq; /* rq "owned" by this entity/group: */ struct rt_rq *my_q; Run queue Priority 0 1 RT task1 RT task2 2 RT task3 18

19 19 Runqueue for Time-sharing Scheduling Class <kernel/sched/sched.h> /* CFS-related fields in a runqueue */ struct cfs_rq struct load_weight load; unsigned int nr_running, h_nr_running; u64 exec_clock; u64 min_vruntime; struct rb_root tasks_timeline; struct rb_node *rb_leftmost; <include/linux/rbtree.h> struct rb_node unsigned long rb_parent_color; struct rb_node *rb_right; struct rb_node *rb_left; attribute ((aligned(sizeof(long)))); struct rb_root ; struct rb_node *rb_node; struct sched_entity *curr, *next, *last, *skip; #ifdef CONFIG_SMP /* * CFS load tracking */ struct sched_avg avg; u64 runnable_load_sum; unsigned long runnable_load_avg; #ifdef CONFIG_FAIR_GROUP_SCHED unsigned long tg_load_avg_contrib; #endif atomic_long_t removed_load_avg, removed_util_avg; #ifdef CONFIG_FAIR_GROUP_SCHED unsigned long h_load; u64 last_h_load_update; struct sched_entity *h_load_next; #endif /* CONFIG_FAIR_GROUP_SCHED */ #endif /* CONFIG_SMP */ ; Task4 Task2 Task5 Task1 Task3 Task6 Task7 struct sched_entity struct load_weight struct rb_node load; run_node; 19

20 20 Stride Scheduling Class Stride Scheduling Task PRACTICE 20

21 21 Stride Scheduling Class Skeleton Download source file TBD Move $ tar -xvf stride.tar $ cd stride stride $ mv kernel/sched/stride.c linux /kernel/sched/ 21

22 22 Compile Stride Scheduler < kernel/sched/makefile> # SPDX-License-Identifier: GPL-2.0 ifdef CONFIG_FUNCTION_TRACER CFLAGS_REMOVE_clock.o = $(CC_FLAGS_FTRACE) endif # These files are disabled because they produce non-interesting flaky coverage # that is not a function of syscall inputs. E.g. involuntary context switches. KCOV_INSTRUMENT := n ifneq ($(CONFIG_SCHED_OMIT_FRAME_POINTER),y) # According to Alan Modra <alan@linuxcare.com.au>, the -fno-omit-frame-pointer is # needed for x86 only. Why this used to be enabled for all architectures is beyond # me. I suspect most platforms don't need this, but until we know that for sure # I turn this off for IA-64 only. Andreas Schwab says it's also needed on m68k # to get a correct value for the wait-channel (WCHAN in ps). --davidm CFLAGS_core.o := $(PROFILING) -fno-omit-frame-pointer endif obj-y += core.o loadavg.o clock.o cputime.o obj-y += idle_task.o fair.o rt.o deadline.o stride.o obj-y += wait.o wait_bit.o swait.o completion.o idle.o obj-$(config_smp) += cpupri.o cpudeadline.o topology.o stop_task.o obj-$(config_sched_autogroup) += autogroup.o obj-$(config_schedstats) += stats.o obj-$(config_sched_debug) += debug.o 22

23 23 Stride Scheduler Skeleton < kernel/sched/stride.c> #define STRIDE_MIN_SCHED_TASK_NO 3 #define STRIDE_SCHED_CNT 10 static inline struct task_struct *stride_task_of(struct sched_stride_entity *se) return container_of(se, struct task_struct, stride); void init_stride_rq(struct stride_rq *stride_rq) stride_rq->stride_nr_running = 0; stride_rq->tasks_timeline = RB_ROOT_CACHED; stride_rq->curr = 0; stride_rq->remain_tickets = STRIDE_TICKETS; stride_rq->sched_cnt = 0; printk(kern_info "***[OS18] Stride class is online \n"); static void update_curr_stride(struct rq *rq) static void enqueue_task_stride(struct rq *rq, struct task_struct *p, int flags) printk("***[os18] Enqueue:::P[%u], nr_running = %u \n", p->pid, rq->stride.stride_nr_running); static void dequeue_task_stride(struct rq *rq, struct task_struct *p, int flags) printk("***[os18] Dequeue:::P[%u], nr_running = %u \n", p->pid, rq->stride.stride_nr_running); static void check_preempt_curr_stride(struct rq *rq, struct task_struct *p, int flags) resched_curr(rq); static struct task_struct *pick_next_task_stride(struct rq *rq, struct task_struct *prev, struct rq_flags *rf) struct sched_stride_entity *se; struct stride_rq *stride_rq = &rq->stride; static void put_prev_task_stride(struct rq *rq, struct task_struct *p) static int select_task_rq_stride(struct task_struct *p, int cpu, int sd_flag, int flags) return task_cpu(p); static void set_curr_task_stride(struct rq *rq) static void task_tick_stride(struct rq *rq, struct task_struct *p, int queued) struct sched_stride_entity *se = &p->stride; printk(kern_info "***[OS18] Tick:::P[%u](stride = %u): pass = %llu \n", p->pid, se->stride, se->pass); static void prio_changed_stride(struct rq *rq, struct task_struct *p, int oldprio) /* This routine is called when a task migrates between classes */ static void switched_to_stride(struct rq *rq, struct task_struct *p) resched_curr(rq); const struct sched_class stride_sched_class =.next.enqueue_task.dequeue_task = &fair_sched_class, = enqueue_task_stride, = dequeue_task_stride,.check_preempt_curr = check_preempt_curr_stride, if (stride_rq->stride_nr_running < STRIDE_MIN_SCHED_TASK_NO) return NULL;.pick_next_task.put_prev_task = pick_next_task_stride, = put_prev_task_stride, #if 0 #else #endif if (stride_rq->sched_cnt++ > STRIDE_SCHED_CNT) return NULL; printk(kern_info "***[OS18] Pick:::P[%u](stride = %u): pass = %llu \n", stride_task_of(se)->pid, se->stride, se->pass); return stride_task_of(se); return NULL; #ifdef CONFIG_SMP #endif ;.select_task_rq.set_curr_task.task_tick.prio_changed.switched_to.update_curr = select_task_rq_stride, = set_curr_task_stride, = task_tick_stride, = prio_changed_stride, = switched_to_stride, = update_curr_stride, 23

24 24 Add Stride Scheduler <kernel/sched/sched.h> extern const struct sched_class fair_sched_class; extern const struct sched_class idle_sched_class; // <-- OS18 extern const struct sched_class stride_sched_class; // --> OS18 // <-- OS18 extern void init_stride_rq(struct stride_rq *stride_rq); // --> OS18 <kernel/sched/rt.c> const struct sched_class rt_sched_class =.next = &stride_sched_class, sched_class_highest stop_sched_class.next dl_sched_class.next rt_sched_class.next stride_class.next fair_sched_class.next 24

25 25 Stride Scheduling Data Structures <include/linux/sched.h> <kernel/sched/sched.h> //<-- OS18 struct sched_stride_entity unsigned int unsigned int unsigned int s64 on_rq; tickets; stride; pass; //<-- OS18 #define STRIDE_TICKETS 1000 struct stride_rq unsigned int stride_nr_running; int remain_tickets; unsigned int sched_cnt; ; //--> OS18 struct task_struct struct rb_node run_node; const struct sched_class *sched_class; struct sched_entity se; struct sched_rt_entity rt; #ifdef CONFIG_CGROUP_SCHED struct task_group *sched_task_group; #endif struct sched_dl_entity dl; //<-- OS18 struct sched_stride_entity stride; //--> OS18 ; ; //--> OS18 struct rq //<-- OS18 //--> OS18 ; struct sched_stride_entity *curr; struct rb_root_cached tasks_timeline; struct cfs_rq cfs; struct rt_rq rt; struct dl_rq dl; struct stride_rq stride; 25

26 26 To Change Scheduling Class (1) <include/uapi/linux/sched/types.h> <kernel/sched/sched.h> struct sched_attr ; u32 size; u32 sched_policy; u64 sched_flags; /* SCHED_NORMAL, SCHED_BATCH */ s32 sched_nice; /* SCHED_FIFO, SCHED_RR */ u32 sched_priority; /* SCHED_DEADLINE */ u64 sched_runtime; u64 sched_deadline; u64 sched_period; // <-- OS18 u32 tickets; // --> OS18 static inline int dl_policy(int policy) return policy == SCHED_DEADLINE; // <-- OS18 static inline int stride_policy(int policy) return policy == SCHED_STRIDE; // --> OS18 static inline bool valid_policy(int policy) return idle_policy(policy) fair_policy(policy) // <-- OS18 stride_policy(policy) // --> OS18 rt_policy(policy) dl_policy(policy); <include/uapi/linux/sched.h> /* * Scheduling policies */ #define SCHED_NORMAL 0 #define SCHED_FIFO 1 #define SCHED_RR 2 #define SCHED_BATCH 3 /* SCHED_ISO: reserved but not implemented yet */ #define SCHED_IDLE 5 #define SCHED_DEADLINE 6 //<-- OS18 #define SCHED_STRIDE 7 //--> OS18 26

27 27 To Change Scheduling Class (2) <kernel/sched/core.c> <kernel/sched/core.c> static void sched_fork(unsigned long clone_flags, struct task_struct *p) INIT_LIST_HEAD(&p->rt.run_list); p->rt.timeout = 0; p->rt.time_slice = sched_rr_timeslice; p->rt.on_rq = 0; p->rt.on_list = 0; // <-- OS18 RB_CLEAR_NODE(&p->stride.run_node); // --> OS18 void init sched_init(void) init_cfs_rq(&rq->cfs); init_rt_rq(&rq->rt); init_dl_rq(&rq->dl); // <-- OS18 init_stride_rq(&rq->stride); // --> OS18 static void setscheduler(struct rq *rq, struct task_struct *p, const struct sched_attr *attr, bool keep_boost) // <-- OS18 struct sched_stride_entity *se; struct stride_rq *stride_rq = &rq->stride; unsigned int temp; // --> OS18 setscheduler_params(p, attr); p->prio = normal_prio(p); if (keep_boost) p->prio = rt_effective_prio(p, p->prio); if (dl_prio(p->prio)) p->sched_class = &dl_sched_class; else if (rt_prio(p->prio)) p->sched_class = &rt_sched_class; // <-- OS18 else if (stride_policy(attr->sched_policy) && (attr->tickets < stride_rq->remain_tickets)) p->sched_class = &stride_sched_class; se = &p->stride; se->tickets = attr->tickets; se->stride = 0; temp = STRIDE_TICKETS; while(temp >= se->tickets) temp -= se->tickets; se->stride++; se->pass = (u64)se->stride; se->on_rq = 0; stride_rq->remain_tickets -= se->tickets; printk("***[os18] task is created: pass = %llu, stride = %u, tickets = %u \n", se->pass, se->stride, se->tickets); // --> OS18 else p->sched_class = &fair_sched_class; 27

28 28 Apply to Kernel linux $ make -j4 linux $ sudo make modules_install linux $ cd /lib/modules/ lib/modules/4.15.6$ sudo find. -name *.ko -exec strip --strip-unneeded + lib/modules/4.15.6$ cd ~/linux linux $ sudo make install linux $ reboot stride/app$ make gcc -g -static -o stride_app app_src.c stride/app$./stride_app ***[OS18] select Stride scheduling class Child's PID = 1967 Child's PID = 1968 ***[OS18] select Stride scheduling class Child's PID = 1969 ***[OS18] select Stride scheduling class 3 tasks are created *** DONE *** stride/app$ ps -ac PID CLS PRI TTY TIME CMD 1967 #7 19 pts/4 00:00:00 newclass 1968 #7 19 pts/4 00:00:00 newclass 1969 #7 19 pts/4 00:00:00 newclass 1970 TS 19 pts/4 00:00:00 ps stride/app$ dmesg grep OS18 [ ] ***[OS18] Stride class is online [ ] ***[OS18] task is created: pass = 25, stride = 25, tickets = 40 [ ] ***[OS18] task is created: pass = 50, stride = 50, tickets = 20 [ ] ***[OS18] task is created: pass = 100, stride = 100, tickets = 10 28

Linux Scheduler. Minsoo Ryu. Department of Computer Science and Engineering. Hanyang University. Real-Time Computing and Communications Lab.

Linux Scheduler. Minsoo Ryu. Department of Computer Science and Engineering. Hanyang University. Real-Time Computing and Communications Lab. Linux Scheduler Minsoo Ryu Department of Computer Science and Engineering 2 1 Introduction to Linux Scheduler Page X 2 Completely Fair Scheduler (CFS) Page X 3 CFS Implementation in the Kernel Page X 4

More information

Linux Task Scheduling

Linux Task Scheduling Linux Task Scheduling Hyunmin Yoon (hmyoon@rtcc.hanyang.ac.kr) 2 This document is based-on linux 4.15.6 version (released at 2018.02.26) 2 3 Task Scheduling COMPLETELY FAIR SCHEDULING 3 4 Completely Fair

More information

Linux Kernel Development (LKD)

Linux Kernel Development (LKD) Linux Kernel Development (LKD) Session 3 CISTER Framework: Laboratory Paulo Baltarejo Sousa pbs@isep.ipp.pt 2017 1 LIFO Scheduling Algorithm It will be added a new scheduling policy to the CISTER framework.

More information

Linux Scheduler. OS 323 (Spring 2013)

Linux Scheduler. OS 323 (Spring 2013) Linux Scheduler OS 323 (Spring 2013) Process states CPU scheduler Makes the computer more productive by switching the CPU among processes CPU scheduling may take place when a process: 1. Switches from

More information

Scheduling II. ! Multilevel queue scheduling. ! Multiprocessor scheduling issues. ! Real-time scheduling. ! Linux scheduling

Scheduling II. ! Multilevel queue scheduling. ! Multiprocessor scheduling issues. ! Real-time scheduling. ! Linux scheduling Scheduling II! Multilevel queue scheduling! Multiprocessor scheduling issues! Real-time scheduling! Linux scheduling 1 Motivation! No one-size-fits-all scheduler " Different workloads " Different environment!

More information

Periodic scheduler for Linux OS. Mike Athanasakis Operating System TA Winter

Periodic scheduler for Linux OS. Mike Athanasakis Operating System TA Winter Periodic scheduler for Linux OS Mike Athanasakis michath@csd.uoc.gr Operating System TA Winter 2015-2016 History Linux v1.2 Round Robin Linux v2.2 Scheduling Classes & Policies Linux v2.4 Division in epochs,

More information

SFO The Linux Kernel Scheduler. Viresh Kumar (PMWG)

SFO The Linux Kernel Scheduler. Viresh Kumar (PMWG) SFO17-421 The Linux Kernel Scheduler Viresh Kumar (PMWG) Topics CPU Scheduler The O(1) scheduler Current scheduler design Scheduling classes schedule() Scheduling classes and policies Sched class: STOP

More information

T. Cucinotta Real-Time Systems Lab (ReTiS) Scuola Superiore Sant'Anna Pisa Italy 1. Real-Time Scheduling on Linux and SCHED_DEADLINE

T. Cucinotta Real-Time Systems Lab (ReTiS) Scuola Superiore Sant'Anna Pisa Italy 1. Real-Time Scheduling on Linux and SCHED_DEADLINE T. Cucinotta Real-Time Systems Lab (ReTiS) Scuola Superiore Sant'Anna Pisa Italy 1 Real-Time Scheduling on Linux and SCHED_DEADLINE Linux CPU Schedulers Scheduling classes and policies Classes listed in

More information

Operating Systems 16 - CS 323 Assignment #2

Operating Systems 16 - CS 323 Assignment #2 Operating Systems 16 - CS 323 Assignment #2 Scheduler March 18, 2016 1 Objectives 1. Learn about scheduling in the Linux kernel 2. Understand the tradeoffs involved in scheduling 3. Work on the codebase

More information

Linux Kernel Development (LKD)

Linux Kernel Development (LKD) Linux Kernel Development (LKD) Session 3 Scheduling and System calls Paulo Baltarejo Sousa pbs@isep.ipp.pt 2017 PBS LKD: S3 1 / 59 Disclaimer Material and Slides Some of the material/slides are adapted

More information

Linux Kernel Development (LKD)

Linux Kernel Development (LKD) Linux Kernel Development (LKD) Session 2 Kernel Build System and Process Management Paulo Baltarejo Sousa pbs@isep.ipp.pt 2017 PBS LKD: S2 1 / 41 Disclaimer Material and Slides Some of the material/slides

More information

Linux Kernel Development (LKD)

Linux Kernel Development (LKD) Linux Kernel Development (LKD) Session 2 CISTER Framework: Laboratory 2 Paulo Baltarejo Sousa pbs@isep.ipp.pt 2017 1 Introduction The goal of the CISTER framework is to create a set of tools that help

More information

Using SCHED DEADLINE in Linux. Luca Abeni

Using SCHED DEADLINE in Linux. Luca Abeni in Linux Luca Abeni luca.abeni@unitn.it Using Fixed Priorities in Linux SCHED FIFO and SCHED RR use fixed priorities They can be used for real-time tasks, to implement RM and DM Real-time tasks have priority

More information

进程调度 南京大学计算机系

进程调度 南京大学计算机系 进程调度 张雷 南京大学计算机系 2018-10-30 CPU Scheduler Lab3 Introduction Linux schedulers Idle Scheduler Real-Time Scheduler Completely Fair Scheduler (CFS) Conclusion CPU Scheduler Lab3 Introduction Linux schedulers

More information

Project 2: Android Scheduler

Project 2: Android Scheduler CS307 Project 2: Android Scheduler Fan Wu Department of Computer Science and Engineering Shanghai Jiao Tong University Spring 2018 1 Objectives 1. Compile the Android kernel. 2. Familiarize Android scheduler

More information

Thread and Synchronization

Thread and Synchronization Thread and Synchronization Task Model (Module 18) Yann-Hang Lee Arizona State University yhlee@asu.edu (480) 727-7507 Summer 2014 Real-time Systems Lab, Computer Science and Engineering, ASU Why Talk About

More information

Process management. Scheduling

Process management. Scheduling Process management Scheduling Points of scheduler invocation (recap) User Kernel Return from system call Process Schedule Return from interrupt handler Timer interrupts to ensure OS control Return from

More information

Dynamic Recrea,on of Kernel Data Structures for Live Forensics. Andrew Case, Lodovico Marziale, Golden G. Richard III DFRWS 2010

Dynamic Recrea,on of Kernel Data Structures for Live Forensics. Andrew Case, Lodovico Marziale, Golden G. Richard III DFRWS 2010 Dynamic Recrea,on of Kernel Data Structures for Live Forensics Andrew Case, Lodovico Marziale, Golden G. Richard III DFRWS 2010 Memory Forensics Acquire a bitwise copy of physical RAM Snapshot of live

More information

Project No. 2: Process Scheduling in Linux Submission due: April 12, 2013, 11:59pm

Project No. 2: Process Scheduling in Linux Submission due: April 12, 2013, 11:59pm Project No. 2: Process Scheduling in Linux Submission due: April 12, 2013, 11:59pm PURPOSE Getting familiar with the Linux kernel source code. Understanding process scheduling and how different parameters

More information

Scheduling policy. Reference: ULK3e 7.1. Scheduling in Linux 1 / 20

Scheduling policy. Reference: ULK3e 7.1. Scheduling in Linux 1 / 20 Scheduling policy Reference: ULK3e 7.1. Goals fast process response time good throughput for background jobs avoidance of process starvation reconciliation of needs of low- and high-priority processes

More information

Operating System Project / Lecture 1 Tasks and scheduling. Bon Keun Seo

Operating System Project / Lecture 1 Tasks and scheduling. Bon Keun Seo Operating System Project / Lecture 1 Tasks and scheduling Bon Keun Seo Program: executable code Program and process Process: a running instance of a program /bin/bash Program (bash) Process 1 (bash) Process

More information

W4118: advanced scheduling

W4118: advanced scheduling W4118: advanced scheduling Instructor: Junfeng Yang References: Modern Operating Systems (3 rd edition), Operating Systems Concepts (8 th edition), previous W4118, and OS at MIT, Stanford, and UWisc Outline

More information

Scalable Linux Scheduling (Paper # 9)

Scalable Linux Scheduling (Paper # 9) Scalable Linux Scheduling (Paper # 9) Scalability: the ability to support large number of threads. 30% of the total CPU time is spent in the scheduler when the number of running threads is high. Linux

More information

Scheduling: Case Studies. CS 161: Lecture 5 2/14/17

Scheduling: Case Studies. CS 161: Lecture 5 2/14/17 Scheduling: Case Studies CS 161: Lecture 5 2/14/17 Scheduling Basics Goal of scheduling: Pick the best task to run on a CPU Often a good idea to prioritize IO-bound tasks If IO comes from user (e.g., keyboard,

More information

Comparison of soft real-time CPU scheduling in Linux kernel 2.6 series with Solaris 10

Comparison of soft real-time CPU scheduling in Linux kernel 2.6 series with Solaris 10 Comparison of soft real-time CPU scheduling in Linux kernel 2.6 series with Solaris 10 Kristoffer Eriksson Philip Frising Department of Computer and Information Science Linköping University 1(15) 1. About

More information

Linux Linux #! "! Linux

Linux Linux #! ! Linux #!! ! 2.5.X % Understanding the Kernel &! 2.5.X kernel/sched.cinclude/linux/sched.h'! Ingo Molnar' ) time! sharing!! &! & Preemptive multitasking SCHED_OTHER * ( & *& real-time!!, & '!! ) TASK_RUNNING!

More information

PROCESSES. Jo, Heeseung

PROCESSES. Jo, Heeseung PROCESSES Jo, Heeseung TODAY'S TOPICS What is the process? How to implement processes? Inter-Process Communication (IPC) 2 WHAT IS THE PROCESS? Program? vs. Process? vs. Processor? 3 PROCESS CONCEPT (1)

More information

Processes. Jo, Heeseung

Processes. Jo, Heeseung Processes Jo, Heeseung Today's Topics What is the process? How to implement processes? Inter-Process Communication (IPC) 2 What Is The Process? Program? vs. Process? vs. Processor? 3 Process Concept (1)

More information

SCHED DEADLINE: a real-time CPU scheduler for Linux

SCHED DEADLINE: a real-time CPU scheduler for Linux : a real-time CPU scheduler for Luca Abeni luca.abeni@santannapisa.it TuToR 2017 Luca Abeni 1 / 33 Scheduling Real-Time Tasks c j f j c j+1 r d j j r f j+1 d j+1 j+1 Consider a set ofn real-time tasks

More information

Linux process scheduling. David Morgan

Linux process scheduling. David Morgan Linux process scheduling David Morgan General neediness categories realtime processes whenever they demand attention, need it immediately other processes interactive care about responsiveness demand no

More information

Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar

Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg Mahmoud El-Gayyar / Introduction to OS 1 Processes in Unix, Linux, and Windows Unix pre-empted

More information

Operating System. Hanyang University. Hyunmin Yoon Operating System Hanyang University

Operating System. Hanyang University. Hyunmin Yoon Operating System Hanyang University Hyunmin Yoon (fulcanelli86@gmail.com) 2 General concept SCHEDULING 2 3 Process Program consists of processes A process includes Program code Data section Global variables Current activity PC (program counter)

More information

PROCESS SCHEDULING Operating Systems Design Euiseong Seo

PROCESS SCHEDULING Operating Systems Design Euiseong Seo PROCESS SCHEDULING 2017 Operating Systems Design Euiseong Seo (euiseong@skku.edu) Histogram of CPU Burst Cycles Alternating Sequence of CPU and IO Processor Scheduling Selects from among the processes

More information

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission Process Heechul Yun Disclaimer: some slides are adopted from the book authors slides with permission 1 Recap OS services Resource (CPU, memory) allocation, filesystem, communication, protection, security,

More information

Processes. Operating System Concepts 8 th Edition

Processes. Operating System Concepts 8 th Edition Processes Silberschatz, Galvin and Gagne 2009 Processes Process Concept Process Scheduling Operations on Processes Inter-process Communication Examples of IPC Systems Communication in Client-Server Systems

More information

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission 1

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission 1 Process Heechul Yun Disclaimer: some slides are adopted from the book authors slides with permission 1 Recap OS services Resource (CPU, memory) allocation, filesystem, communication, protection, security,

More information

Processes & Threads. Today. Next Time. ! Process concept! Process model! Implementing processes! Multiprocessing once again. ! More of the same J

Processes & Threads. Today. Next Time. ! Process concept! Process model! Implementing processes! Multiprocessing once again. ! More of the same J Processes & Threads Today! Process concept! Process model! Implementing processes! Multiprocessing once again Next Time! More of the same J The process model! Most computers can do more than one thing

More information

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo

PROCESS MANAGEMENT. Operating Systems 2015 Spring by Euiseong Seo PROCESS MANAGEMENT Operating Systems 2015 Spring by Euiseong Seo Today s Topics Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication

More information

Chapter 5: CPU Scheduling. Operating System Concepts 9 th Edit9on

Chapter 5: CPU Scheduling. Operating System Concepts 9 th Edit9on Chapter 5: CPU Scheduling Operating System Concepts 9 th Edit9on Silberschatz, Galvin and Gagne 2013 Chapter 6: CPU Scheduling 1. Basic Concepts 2. Scheduling Criteria 3. Scheduling Algorithms 4. Thread

More information

Lecture 3: Processes. CMPUT 379, Section A1, Winter 2014 January 13, 15 and 17

Lecture 3: Processes. CMPUT 379, Section A1, Winter 2014 January 13, 15 and 17 Lecture 3: Processes CMPUT 379, Section A1, Winter 2014 January 13, 15 and 17 Objectives Understand the notion of a process : a program in execution which forms the basis of all computation Understand

More information

Load Balancing. Minsoo Ryu. Department of Computer Science and Engineering. Hanyang University. Real-Time Computing and Communications Lab.

Load Balancing. Minsoo Ryu. Department of Computer Science and Engineering. Hanyang University. Real-Time Computing and Communications Lab. Load Balancing Minsoo Ryu Department of Computer Science and Engineering 2 1 Concepts of Load Balancing Page X 2 Load Balancing Algorithms Page X 3 Overhead of Load Balancing Page X 4 Load Balancing in

More information

Ineffective and effective way to find out latency bottlenecks by Ftrace

Ineffective and effective way to find out latency bottlenecks by Ftrace Ineffective and effective way to find out latency bottlenecks by Ftrace Yoshitake Kobayashi Advanced Software Technology Group Corporate Software Engineering Center TOSHIBA CORPORATION 16 Feb, 212 Copyright

More information

Deadline Miss Detection with SCHED_DEADLINE

Deadline Miss Detection with SCHED_DEADLINE Deadline Miss Detection with SCHED_DEADLINE Yoshitake Kobayashi Advanced Software Technology Group Corporate Software Engineering Center TOSHIBA CORPORATION Copyright 2013, Toshiba Corporation. Resources

More information

CPU Scheduling (Part II)

CPU Scheduling (Part II) CPU Scheduling (Part II) Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) CPU Scheduling 1393/7/28 1 / 58 Motivation Amir H. Payberah

More information

Published By NYLXS Author: Fernando Gutierrez, Ruben Safr ISBN Copyright 2015 under the GPL FDL by NYLXS

Published By NYLXS  Author: Fernando Gutierrez, Ruben Safr ISBN Copyright 2015 under the GPL FDL by NYLXS 1 2 Published By NYLXS http://www.mrbrklyn.com Author: Fernando Gutierrez, Ruben Safr ISBN 978-1-329-11030-4 Copyright 2015 under the GPL FDL by NYLXS Spring is here, and after a very cold winter, activities

More information

PROCESS MANAGEMENT Operating Systems Design Euiseong Seo

PROCESS MANAGEMENT Operating Systems Design Euiseong Seo PROCESS MANAGEMENT 2016 Operating Systems Design Euiseong Seo (euiseong@skku.edu) Definition A process is a program in execution Context Resources Specifically, Register file state Address space File and

More information

Prepared by Prof. Hui Jiang Process. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

Prepared by Prof. Hui Jiang Process. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University EECS3221.3 Operating System Fundamentals No.2 Process Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University How OS manages CPU usage? How CPU is used? Users use CPU to run

More information

Processes Topics Processes Context switching Scheduling

Processes Topics Processes Context switching Scheduling CENG334 Introduction to Operating Systems Processes Topics Processes Context switching Scheduling Erol Sahin Dept of Computer Eng. Middle East Technical University Ankara, TURKEY URL: http://kovan.ceng.metu.edu.tr/~erol/courses/ceng334

More information

Processes. Today. Next Time. ! Process concept! Process model! Implementing processes! Multiprocessing once again. ! Scheduling processes

Processes. Today. Next Time. ! Process concept! Process model! Implementing processes! Multiprocessing once again. ! Scheduling processes Processes Today! Process concept! Process model! Implementing processes! Multiprocessing once again Next Time! Scheduling processes The process model! Most computers can do more than one thing at a time

More information

Process. Prepared by Prof. Hui Jiang Dept. of EECS, York Univ. 1. Process in Memory (I) PROCESS. Process. How OS manages CPU usage? No.

Process. Prepared by Prof. Hui Jiang Dept. of EECS, York Univ. 1. Process in Memory (I) PROCESS. Process. How OS manages CPU usage? No. EECS3221.3 Operating System Fundamentals No.2 Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University How OS manages CPU usage? How CPU is used? Users use CPU to run programs

More information

OS lpr. www. nfsd gcc emacs ls 9/18/11. Process Management. CS 537 Lecture 4: Processes. The Process. Why Processes? Simplicity + Speed

OS lpr. www. nfsd gcc emacs ls 9/18/11. Process Management. CS 537 Lecture 4: Processes. The Process. Why Processes? Simplicity + Speed Process Management CS 537 Lecture 4: Processes Today: processes and process management what are the OS units of execution? how are they represented inside the OS? how is the CPU scheduled across processes?

More information

/sleeper Work: VOL CS: IVOL CS: /CPU Work: VOL CS: IVOL CS: /IO Work: VOL CS: IVOL CS: Each of the

/sleeper Work: VOL CS: IVOL CS: /CPU Work: VOL CS: IVOL CS: /IO Work: VOL CS: IVOL CS: Each of the - 1-1 CS 460 Scheduling Lab 2 3 Shutdown VB and change the System to use 2 CPUs. 4 5 Open terminator! 6 7 wget http://zeus.cs.pacificu.edu/chadd/cs460s18/schedlab.tar.gz 8 9 tar xzf SchedLab.tar.gz 10

More information

Scheduling. Scheduling 1/51

Scheduling. Scheduling 1/51 Scheduling 1/51 Learning Objectives Scheduling To understand the role of a scheduler in an operating system To understand the scheduling mechanism To understand scheduling strategies such as non-preemptive

More information

OS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed

OS lpr. www. nfsd gcc emacs ls 1/27/09. Process Management. CS 537 Lecture 3: Processes. Example OS in operation. Why Processes? Simplicity + Speed Process Management CS 537 Lecture 3: Processes Michael Swift This lecture begins a series of topics on processes, threads, and synchronization Today: processes and process management what are the OS units

More information

CPSC 341 OS & Networks. Processes. Dr. Yingwu Zhu

CPSC 341 OS & Networks. Processes. Dr. Yingwu Zhu CPSC 341 OS & Networks Processes Dr. Yingwu Zhu Process Concept Process a program in execution What is not a process? -- program on a disk A process is an active object, but a program is just a file It

More information

www nfsd emacs lpr Process Management CS 537 Lecture 4: Processes Example OS in operation Why Processes? Simplicity + Speed

www nfsd emacs lpr Process Management CS 537 Lecture 4: Processes Example OS in operation Why Processes? Simplicity + Speed Process Management CS 537 Lecture 4: Processes Michael Swift This lecture begins a series of topics on processes, threads, and synchronization Today: processes and process management what are the OS units

More information

Recap. Run to completion in order of arrival Pros: simple, low overhead, good for batch jobs Cons: short jobs can stuck behind the long ones

Recap. Run to completion in order of arrival Pros: simple, low overhead, good for batch jobs Cons: short jobs can stuck behind the long ones Recap First-Come, First-Served (FCFS) Run to completion in order of arrival Pros: simple, low overhead, good for batch jobs Cons: short jobs can stuck behind the long ones Round-Robin (RR) FCFS with preemption.

More information

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Processes Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu OS Internals User space shell ls trap shell ps Kernel space File System Management I/O

More information

D3.6 Final Operating System with Real-Time Support

D3.6 Final Operating System with Real-Time Support Project Number 318763 D3.6 Final Operating System with Real-Time Support Version 1.0 Final Public Distribution Scuola Superiore Sant Anna Project Partners: aicas, HMI, petafuel, SOFTEAM, Scuola Superiore

More information

Evaluation of Real-time Performance in Embedded Linux. Hiraku Toyooka, Hitachi. LinuxCon Europe Hitachi, Ltd All rights reserved.

Evaluation of Real-time Performance in Embedded Linux. Hiraku Toyooka, Hitachi. LinuxCon Europe Hitachi, Ltd All rights reserved. Evaluation of Real-time Performance in Embedded Linux LinuxCon Europe 2014 Hiraku Toyooka, Hitachi 1 whoami Hiraku Toyooka Software engineer at Hitachi " Working on operating systems Linux (mainly) for

More information

CS 378 (Spring 2003)

CS 378 (Spring 2003) Department of Computer Sciences THE UNIVERSITY OF TEXAS AT AUSTIN CS 378 (Spring 2003) Linux Kernel Programming Yongguang Zhang (ygz@cs.utexas.edu) Copyright 2003, Yongguang Zhang This Lecture Last Lecture:

More information

Term Project Phase II: The Scheduler Ter m Proj ect Phas e II:

Term Project Phase II: The Scheduler Ter m Proj ect Phas e II: cse331 fall 2011 Term Project Phase II: The Scheduler Ter m Proj ect Phas e II: Goal: You will Iearn more about how process management is designed, particularly how the scheduler is implemented. The scheduler

More information

Scheduling - Overview

Scheduling - Overview Scheduling - Overview Quick review of textbook scheduling Linux 2.4 scheduler implementation overview Linux 2.4 scheduler code Modified Linux 2.4 scheduler Linux 2.6 scheduler comments Possible Goals of

More information

Proxy Execution. Peter Zijlstra Intel OTC

Proxy Execution. Peter Zijlstra Intel OTC Proxy Execution Peter Zijlstra Intel OTC Why Scheduler dependent inheritance schemes: Static priority; FIFO/RR Priority inheritance Job priority; DEADLINE Deadline inheritance; insufficient Bandwidth inheritance;

More information

CS356 Operating System Projects Spring Project 2: Android scheduler

CS356 Operating System Projects Spring Project 2: Android scheduler CS356 Operating System Projects Spring 2018 Project 2: Android scheduler Objectives: Compile the Android kernel. Familiarize Android scheduler Implement a weighted round robin scheduler. Get experience

More information

Process management. What s in a process? What is a process? The OS s process namespace. A process s address space (idealized)

Process management. What s in a process? What is a process? The OS s process namespace. A process s address space (idealized) Process management CSE 451: Operating Systems Spring 2012 Module 4 Processes Ed Lazowska lazowska@cs.washington.edu Allen Center 570 This module begins a series of topics on processes, threads, and synchronization

More information

INF1060: Introduction to Operating Systems and Data Communication. Pål Halvorsen. Wednesday, September 29, 2010

INF1060: Introduction to Operating Systems and Data Communication. Pål Halvorsen. Wednesday, September 29, 2010 INF1060: Introduction to Operating Systems and Data Communication Pål Halvorsen Wednesday, September 29, 2010 Overview Processes primitives for creation and termination states context switches processes

More information

CSE 451: Operating Systems Winter Module 4 Processes. Mark Zbikowski Allen Center 476

CSE 451: Operating Systems Winter Module 4 Processes. Mark Zbikowski Allen Center 476 CSE 451: Operating Systems Winter 2015 Module 4 Processes Mark Zbikowski mzbik@cs.washington.edu Allen Center 476 2013 Gribble, Lazowska, Levy, Zahorjan Process management This module begins a series of

More information

CS 4284 Systems Capstone. Resource Allocation & Scheduling Godmar Back

CS 4284 Systems Capstone. Resource Allocation & Scheduling Godmar Back CS 4284 Systems Capstone Resource Allocation & Scheduling Godmar Back Resource Allocation and Scheduling Resource Allocation & Scheduling Resource management is primary OS function Involves resource allocation

More information

Scheduling. Scheduling 1/51

Scheduling. Scheduling 1/51 Scheduling 1/51 Scheduler Scheduling Scheduler allocates cpu(s) to threads and processes. This action is known as scheduling. The scheduler is a part of the process manager code that handles scheduling.

More information

CS 322 Operating Systems Practice Midterm Questions

CS 322 Operating Systems Practice Midterm Questions ! CS 322 Operating Systems 1. Processes go through the following states in their lifetime. time slice ends Consider the following events and answer the questions that follow. Assume there are 5 processes,

More information

CS 537 Lecture 2 - Processes

CS 537 Lecture 2 - Processes CS 537 Lecture 2 - Processes Michael Swift 1 Basic Structure Kernel is a big program that starts when you boot your program Has full access to physical hardware. User programs, utilities, services see

More information

Operating Systems and Networks Assignment 9

Operating Systems and Networks Assignment 9 Spring Term 01 Operating Systems and Networks Assignment 9 Assigned on: rd May 01 Due by: 10th May 01 1 General Operating Systems Questions a) What is the purpose of having a kernel? Answer: A kernel is

More information

Computer Systems Laboratory Sungkyunkwan University

Computer Systems Laboratory Sungkyunkwan University CPU Scheduling Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Today s Topics General scheduling concepts Scheduling algorithms Case studies Linux

More information

Process Sheduling Lab

Process Sheduling Lab Process Sheduling Lab CSCI411 Lab Inspired by Operating System Concepts, 8 th Edition, Silberschatz, Galvin, Gagne Adapted by M.D Doman 2013 Exercise Goal: You will learn more about how process management

More information

High level scheduling: Medium level scheduling: Low level scheduling. Scheduling 0 : Levels

High level scheduling: Medium level scheduling: Low level scheduling. Scheduling 0 : Levels Scheduling 0 : Levels High level scheduling: Deciding whether another process can run is process table full? user process limit reached? load to swap space or memory? Medium level scheduling: Balancing

More information

Operating Systems and Networks Assignment 2

Operating Systems and Networks Assignment 2 Spring Term 2014 Operating Systems and Networks Assignment 2 Assigned on: 27th February 2014 Due by: 6th March 2014 1 Scheduling The following table describes tasks to be scheduled. The table contains

More information

Processes. Operating System CS 217. Supports virtual machines. Provides services: User Process. User Process. OS Kernel. Hardware

Processes. Operating System CS 217. Supports virtual machines. Provides services: User Process. User Process. OS Kernel. Hardware es CS 217 Operating System Supports virtual machines Promises each process the illusion of having whole machine to itself Provides services: Protection Scheduling Memory management File systems Synchronization

More information

Processes. q Process concept q Process model and implementation q Multiprocessing once again q Next Time: Scheduling

Processes. q Process concept q Process model and implementation q Multiprocessing once again q Next Time: Scheduling Processes q Process concept q Process model and implementation q Multiprocessing once again q Next Time: Scheduling The process model Computers can do more than one thing at a time Hard to keep track of

More information

Linux Kernel PROCESS. Copyrighted to

Linux Kernel PROCESS. Copyrighted to Linux Kernel PROCESS 1 Copyrighted to www.suvenconsultants.com Process : a running program. Individual processes exist independently alongside each other and cannot affect each other directly. Each process

More information

What Is A Process? Process States. Process Concept. Process Control Block (PCB) Process State Transition Diagram 9/6/2013. Process Fundamentals

What Is A Process? Process States. Process Concept. Process Control Block (PCB) Process State Transition Diagram 9/6/2013. Process Fundamentals What Is A Process? A process is a program in execution. Process Fundamentals #include int main(int argc, char*argv[]) { int v; printf( hello world\n ); scanf( %d, &v); return 0; Program test

More information

Chapter 3: Processes. Operating System Concepts 9 th Edit9on

Chapter 3: Processes. Operating System Concepts 9 th Edit9on Chapter 3: Processes Operating System Concepts 9 th Edit9on Silberschatz, Galvin and Gagne 2013 Chapter 3: Processes 1. Process Concept 2. Process Scheduling 3. Operations on Processes 4. Interprocess

More information

Threads. What is a thread? Motivation. Single and Multithreaded Processes. Benefits

Threads. What is a thread? Motivation. Single and Multithreaded Processes. Benefits CS307 What is a thread? Threads A thread is a basic unit of CPU utilization contains a thread ID, a program counter, a register set, and a stack shares with other threads belonging to the same process

More information

Computer Systems Assignment 2: Fork and Threads Package

Computer Systems Assignment 2: Fork and Threads Package Autumn Term 2018 Distributed Computing Computer Systems Assignment 2: Fork and Threads Package Assigned on: October 5, 2018 Due by: October 12, 2018 1 Understanding fork() and exec() Creating new processes

More information

What is a process. Ausgewählte Betriebssysteme. Process state. task_struct. Processes and Threads

What is a process. Ausgewählte Betriebssysteme. Process state. task_struct. Processes and Threads Ausgewählte Betriebssysteme What is a process Fundamental concept for multiprogramming Instance of program in execution Sequential control flow Processes and Threads Entity to which system resources are

More information

Processes. Process Management Chapter 3. When does a process gets created? When does a process gets terminated?

Processes. Process Management Chapter 3. When does a process gets created? When does a process gets terminated? Processes Process Management Chapter 3 1 A process is a program in a state of execution (created but not terminated) Program is a passive entity one on your disk (survivor.class, kelly.out, ) Process is

More information

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2

Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2 Lecture 3: Processes Agenda Process Concept Process Scheduling Operations on Processes Interprocess Communication 3.2 Process in General 3.3 Process Concept Process is an active program in execution; process

More information

Chap 4, 5: Process. Dongkun Shin, SKKU

Chap 4, 5: Process. Dongkun Shin, SKKU Chap 4, 5: Process 1 Process Concept Job A bundle of program and data to be executed An entity before submission for execution Process (= running program) An entity that is registered to kernel for execution

More information

CS3210: Processes and switching 1. Taesoo Kim

CS3210: Processes and switching 1. Taesoo Kim 1 CS3210: Processes and switching 1 Taesoo Kim 2 Administrivia (Mar 17) Team Proposal Day (just slides, 3-5 min/team) Problem statement Idea Demo plan (aka evaluation) Timeline DUE : submit slides (as

More information

Class average is Undergraduates are performing better. Working with low-level microcontroller timers

Class average is Undergraduates are performing better. Working with low-level microcontroller timers Student feedback Low grades of the midterm exam Class average is 86.16 Undergraduates are performing better Cheat sheet on the final exam? You will be allowed to bring one page of cheat sheet to the final

More information

Multithreaded Programming

Multithreaded Programming Multithreaded Programming The slides do not contain all the information and cannot be treated as a study material for Operating System. Please refer the text book for exams. September 4, 2014 Topics Overview

More information

Xenomai Real-Time nanokernel

Xenomai Real-Time nanokernel Xenomai Real-Time nanokernel Ricardo Correia Pinto ricardo.pinto@ciencias.ulisboa.pt Faculty of Sciences - University of Lisboa Sistemas Embebidos e de Tempo-Real 2014/2015 Xenomai Real-Time nanokernel

More information

CSCE Operating Systems Interrupts, Exceptions, and Signals. Qiang Zeng, Ph.D. Fall 2018

CSCE Operating Systems Interrupts, Exceptions, and Signals. Qiang Zeng, Ph.D. Fall 2018 CSCE 311 - Operating Systems Interrupts, Exceptions, and Signals Qiang Zeng, Ph.D. Fall 2018 Previous Class Process state transition Ready, blocked, running Call Stack Execution Context Process switch

More information

4.8 Summary. Practice Exercises

4.8 Summary. Practice Exercises Practice Exercises 191 structures of the parent process. A new task is also created when the clone() system call is made. However, rather than copying all data structures, the new task points to the data

More information

CISC2200 Threads Spring 2015

CISC2200 Threads Spring 2015 CISC2200 Threads Spring 2015 Process We learn the concept of process A program in execution A process owns some resources A process executes a program => execution state, PC, We learn that bash creates

More information

Context Switching & CPU Scheduling

Context Switching & CPU Scheduling Context Switching & CPU Scheduling Nima Honarmand Administrivia Midterm: next Tuesday, 10/17, in class Will include everything discussed until then Will cover: Class lectures, slides and discussions All

More information

AutoNUMA Red Hat, Inc.

AutoNUMA Red Hat, Inc. AutoNUMA Red Hat, Inc. Andrea Arcangeli aarcange at redhat.com 1 Apr 2012 AutoNUMA components knuma_scand If stopped, everything stops Triggers the chain reaction when started NUMA hinting page faults

More information

Maintaining a Real Time Stable Kernel What s different than a vanilla stable kernel?

Maintaining a Real Time Stable Kernel What s different than a vanilla stable kernel? Maintaining a Real Time Stable Kernel What s different than a vanilla stable kernel? Steven Rostedt 3/13/2018 2016 2018 VMware Inc. All rights reserved. Upstream Stable Releases After all mainline releases

More information

CSE 410: Computer Systems Spring Processes. John Zahorjan Allen Center 534

CSE 410: Computer Systems Spring Processes. John Zahorjan Allen Center 534 CSE 410: Computer Systems Spring 2018 Processes John Zahorjan zahorjan@cs.washington.edu Allen Center 534 1. What is a process? Processes 2. What's the process namespace? 3. How are processes represented

More information

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017 ECE 550D Fundamentals of Computer Systems and Engineering Fall 2017 The Operating System (OS) Prof. John Board Duke University Slides are derived from work by Profs. Tyler Bletsch and Andrew Hilton (Duke)

More information