Introduction to Embedded Systems Traditional OS Processes and Scheduling Lecture 15hb.

Slides:



Advertisements
Similar presentations
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Advertisements

Uniprocessor Scheduling Chapter 9 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Chapter 3 Process Description and Control
1 Traditional Unix Scheduling “Traditional” means –No consideration on realtime processes. –Typically 4.3BSD and SVR3 MFQ-based –Preemptive (time quantum.
CSE 451: Operating Systems Winter 2006 Module 4 Processes Ed Lazowska Allen Center 570.
Processes CSCI 444/544 Operating Systems Fall 2008.
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
1 Multilevel Feedback Queue Scheduling Another way to put a preference on short-lived processes –Penalize processes that have been running longer. Preemptive.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Operating Systems (CSCI2413) Lecture 3 Processes phones off (please)
Process Description and Control A process is sometimes called a task, it is a program in execution.
1 Lecture 10: Uniprocessor Scheduling. 2 CPU Scheduling n The problem: scheduling the usage of a single processor among all the existing processes in.
Intro to OS CUCS Mossé Processes and Threads What is a process? What is a thread? What types? A program has one or more locus of execution. Each execution.
Phones OFF Please Processes Parminder Singh Kang Home:
BINA RAMAMURTHY UNIVERSITY AT BUFFALO System Structure and Process Model 5/30/2013 Amrita-UB-MSES
1Chapter 05, Fall 2008 CPU Scheduling The CPU scheduler (sometimes called the dispatcher or short-term scheduler): Selects a process from the ready queue.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
CE Operating Systems Lecture 5 Processes. Overview of lecture In this lecture we will be looking at What is a process? Structure of a process Process.
Chapter 9 Uniprocessor Scheduling Spring, 2011 School of Computer Science & Engineering Chung-Ang University.
Introduction to Processes CS Intoduction to Operating Systems.
Implementing Processes and Process Management Brian Bershad.
Scheduling Basic scheduling policies, for OS schedulers (threads, tasks, processes) or thread library schedulers Review of Context Switching overheads.
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
Exec Function calls Used to begin a processes execution. Accomplished by overwriting process imaged of caller with that of called. Several flavors, use.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-1 Process Concepts Department of Computer Science and Software.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Operating Systems Process Management.
CE Operating Systems Lecture 11 Windows – Object manager and process management.
OS, , Part II Processes Department of Computer Engineering, PSUWannarat Suntiamorntut.
Process A program in execution. But, What does it mean to be “in execution”?
CE Operating Systems Lecture 10 Processes and process management in Linux.
8-Sep Operating Systems Yasir Kiani. 8-Sep Agenda for Today Review of previous lecture Process scheduling concepts Process creation and termination.
Lecture 7: Scheduling preemptive/non-preemptive scheduler CPU bursts
1 Uniprocessor Scheduling Chapter 9. 2 Aim of Scheduling Response time Throughput Processor efficiency.
Uniprocessor Scheduling
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,
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
1 Unix Architecture. 2 Operating Systems Concepts 1. Process 2. Memory management 3. Information protection & security 4. Scheduling and resource management.
1  process  process creation/termination  context  process control block (PCB)  context switch  5-state process model  process scheduling short/medium/long.
OBJECTIVE: To learn about the various system calls. To perform the various CPU scheduling algorithms. To understand the concept of memory management schemes.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
Processes 2 Introduction to Operating Systems: Module 4.
CSC414 “Introduction to UNIX/ Linux” Lecture 3
Copyright © Curt Hill More on Operating Systems Continuation of Introduction.
S ALVATORE DI G IROLAMO (TA) Networks and Operating Systems: Exercise Session 1.
Threads prepared and instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University 1July 2016Processes.
Uniprocessor Scheduling Chapter 9 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College, Venice,
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Multiprogramming. Readings r Chapter 2.1 of the textbook.
Processes and threads.
Process Management Process Concept Why only the global variables?
Chapter 9: Virtual Memory
System Structure and Process Model
System Structure and Process Model
Process management Information maintained by OS for process management
System Structure B. Ramamurthy.
A Comparison Study of Process Scheduling in FreeBSD, Linux and Win2k
System Structure and Process Model
Operating Systems Lecture 6.
Process & its States Lecture 5.
Mid Term review CSC345.
Process Description and Control
Process Description and Control
CSE 451: Operating Systems Winter 2003 Lecture 4 Processes
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
CS510 Operating System Foundations
Presentation transcript:

Introduction to Embedded Systems Traditional OS Processes and Scheduling Lecture 15hb

Introduction to Embedded Systems Summary of Previous Lecture Virtual memory –Virtual addresses –Page tables –Page faults; thrashing

Introduction to Embedded Systems Administrivia Quiz #3 in the second half of today’s lecture –Will be open book/open notes Mid-Term Exam Will be open book/open notes –Mid-term grades will be based on Quizzes #1-3 and Labs 1-2

Introduction to Embedded Systems Outline of This Lecture Why also understand traditional OS processes and scheduling? Unix processes Traditional Unix Scheduling

Introduction to Embedded Systems Why Understand Traditional OS Notions? To understand what is possible, To understand what is done on traditional OSs, Most importantly, to understand how and why embedded (real-time) operating systems are common in some aspects and different in other aspects

Introduction to Embedded Systems Dispatching The dispatcher (short­term scheduler) is the entity responsible for adding a process/thread to the run queue. It is invoked by the scheduler upon an event –Examples include: End of a quantum End of a period End of a process End of a thread This thread of execution is explicitly invoked when something happens The thread is, however, loaded up in memory. –Where? –What is the address space of this thread?

Introduction to Embedded Systems Address Spaces Each heavyweight process has its own address space Each thread shares its address space and global data structures with other threads in the same process There are provisions to share memory among heavyweight processes: shared memory –In Unix, you have to explicitly declare the shmem, get an id for the area, attach yourself to it. Another way of sharing some info is between parent and child processes –They share the list of open files and the code of the process (executable image)

Introduction to Embedded Systems Forking and Processes When a Unix process calls a fork() at some point in the code, a new (child) process becomes ready at the same point of the parent process How does one define who is the parent (child) process? PID = fork() returns a process identifier (PID) –In the child process, the value of the PID is zero –In the parent process, PID contains the child's PID This PID is useful for the parent process to keep track of all its children –e.g., who is alive, who terminated

Introduction to Embedded Systems What happens on a fork() call? if (PID == 0) { /* this is the child process; * add your code here for a small fee */ } else { children[current_child] = PID; current_child++; /* this is the rest of the parent *process; continue your code here * E.g.: wait for your child process to * come back. */ }

Introduction to Embedded Systems UNIX Processes The bootstrap program will start the init process init is the parent of all processes It will fork off terminal processes ( tty ) by reading the /etc/ttys file Each terminal has a process associated with it –e.g., it is this process that prints the “prompt”, does validation of userid/password and then waits for input Many of the user ( shell ) commands will fork off a new process to work on the user commands.

Introduction to Embedded Systems Unix On the other hand, some processes are initialized by the kernel itself (after all the main functions were put in place correctly). In Unix, processes that run in the background, such as printing or the ftp manager, are called daemons –These daemons complement the kernel functionality Everything in Unix is a process and the kernel is stiff (single locus of execution) but efficient

Introduction to Embedded Systems Unix Scheduling The problem with multiple queues is starvation –This can be solved by aging, which means that the longer a process executes, the higher its priority –Unix scheduling is round-robin with multi­level feedback –It computes the priority of the processes according to the user directives, resource usage and aging User directives: nice command (positive integer) Resource usage is computed by the kernel –Aging is computed by increasing the priority of the process every quantum regardless of anything else

Introduction to Embedded Systems Unix Scheduling (cont) The algorithm for setting the priority, at each quantum: –CPU_usage = CPU_usage/2 –priority = CPU_usage/2 + base_priority + nice_level –base_priority is typically set to 70 –nice_level is typically 0, unless nice command is used –CPU_usage starts out as 0, clearly –Initial priority starts out the same as base_priority Does this algorithm actually give higher priority to aging processes? Does it take into consideration resource usage?

Introduction to Embedded Systems Example of UNIX scheduler Quantum 1sec, base priority 60, nice 0, init priority 0 Clock interrupts the system 60 times/sec (or 60 times/quantum) –At each interrupt, CPU usage is incremented –Thus, in one quantum, CPU usage increases by 60 At every quantum, kernel performs calculations –CPU = decay(CPU) = CPU/2 –Process priority = (CPU/2) + 60 time procA procB procC pr CPU pr CPUpr CPU , , , , ,

Introduction to Embedded Systems More on Unix Scheduling Priorities in Unix are divided into Kernel and User Some processes executing with Kernel priority are non­ preemptable –e.g., disk­related system calls Processes executing with User priority are preemptable –user processes, or system functions executing for the user Unix grants higher priorities to processes waiting for lower­ level algorithms (e.g., disk read/write). –why? UNIX disregards the job characteristics –e.g., IO­bound or CPU­bound processes when scheduling

Introduction to Embedded Systems The “top” Utility on Unix (/usr/bin/top)

Introduction to Embedded Systems Summary of Lecture Dispatching Unix as an example of a traditional general-purpose OS –Unix processes and threads Unix Scheduling Looking at “top” GOOD LUCK FOR QUIZ #3!!