1 / 6

Linux Process (Task) Structure and Scheduling Overview

Linux Process (Task) Structure and Scheduling Overview. CS3013 C02 Jae Chung & Hariharan Kannan. Process Control Block (PCB). Process is called “ Task ” in Linux PCB: struct task_struct Essentials : pid, state, *stack, *files, *semaphore Task Ment : *next_task, *prev_task, *ptree, …

dbarlett
Download Presentation

Linux Process (Task) Structure and Scheduling Overview

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Linux Process (Task) Structure and Scheduling Overview CS3013 C02 Jae Chung & Hariharan Kannan

  2. Process Control Block (PCB) • Process is called “Task” in Linux • PCB: struct task_struct • Essentials: pid, state, *stack, *files, *semaphore • Task Ment: *next_task, *prev_task, *ptree, … • Task Sched: priority, counter, *next_run, *prev_run • Resource Usage: times, maj_flt, min_flt, nswap • And more …

  3. Init (0) Init (0) 1 … n 1 2 3 … … … … Init (0) 3 … m Task Managements Task Tree (All Tasks) Task List (All Tasks) Run Queue (Ready Tasks)

  4. Linux Scheduler Functions • (Previous process give up CPU) • Handles interrupts (latter half) • Select next process (task) to run • Performs context switch if necessary • (Let go the next process selected)

  5. Linux Process Scheduling • Normal: Credit-Based (counter variable) • process with most credits is selected • goodness() = 0 (if counter = 0) • goodness() = counter + priority (otherwise) • Timer goes off (jiffy, 1 per 10 ms) • then lose a count (0, then suspend) • No runnable process (all suspended) • reload (recalculate) counter value • counter = counter/2 + priority • Real-Time: goodness() = 1000 + rt_priority

  6. Kernel Source Files to Start • /usr/src/linux/include/linux/sched.h • /usr/src/linux/kernel/sched.c • /usr/src/linux/kernel/sys.c (getrusage) • /usr/src/linux/kernel/fork.c (fork)

More Related