1 Chapter 4 Processes R. C. Chang. 2 Linux Processes n Each process is represented by a task_struct data structure (task and process are terms that Linux.

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

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
CSE 451: Operating Systems Winter 2007 Module 4 Processes Ed Lazowska Allen Center 570.
CSE 451: Operating Systems Winter 2006 Module 4 Processes Ed Lazowska Allen Center 570.
Process Description and Control Chapter 3. Major Requirements of an Operating System Interleave the execution of several processes to maximize processor.
Processes CSCI 444/544 Operating Systems Fall 2008.
1 Process Description and Control Chapter 3. 2 Process Management—Fundamental task of an OS The OS is responsible for: Allocation of resources to processes.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Process in Unix, Linux and Windows CS-3013 C-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
Ceng Operating Systems Chapter 2.1 : Processes Process concept Process scheduling Interprocess communication Deadlocks Threads.
CS-502 Fall 2006Processes in Unix, Linux, & Windows 1 Processes in Unix, Linux, and Windows CS502 Operating Systems.
Unix & Windows Processes 1 CS502 Spring 2006 Unix/Windows Processes.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Process Description and Control A process is sometimes called a task, it is a program in execution.
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
Process in Unix, Linux, and Windows CS-3013 A-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
Introduction to Processes CS Intoduction to Operating Systems.
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
Chapter 3 Process Description and Control
The Structure of Processes. What is a Process? an instance of running program Program vs process(task) Program : just a passive collection of instructions.
Operating Systems 1 K. Salah Module 2.0: Processes Process Concept Trace of Processes Process Context Context Switching Threads –ULT –KLT.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
1 Chapter 2.1 : Processes Process concept Process concept Process scheduling Process scheduling Interprocess communication Interprocess communication Threads.
Threads G.Anuradha (Reference : William Stallings)
4P13 Week 3 Talking Points 1. Process State 2 Process Structure Catagories – Process identification: the PID and the parent PID – Signal state: signals.
1 Threads, SMP, and Microkernels Chapter Multithreading Operating system supports multiple threads of execution within a single process MS-DOS.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
4P13 Week 2 & 3 Talking Points 1. Kernel Processes 2.
CSC 660: Advanced Operating SystemsSlide #1 CSC 660: Advanced OS Processes.
Multi-Tasking The Multi-Tasking service is offered by VxWorks with its real- time kernel “WIND”.
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.
CSC 660: Advanced Operating Systems
1 Structure of Processes Chapter 6 Process State and Transition Data Structure for Process Layout of System Memory THE DESIGN OF THE UNIX OPERATING SYSTEM.
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.
What is a Process ? A program in execution.
CS703 – Advanced Operating Systems By Mr. Farhan Zaidi.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Process Management Process Concept Why only the global variables?
CS 6560: Operating Systems Design
Processes A process is a running program.
Processes in Unix, Linux, and Windows
IT 344: Operating Systems Module 4 Processes
Structure of Processes
Processes in Unix, Linux, and Windows
More examples How many processes does this piece of code create?
Processes in Unix, Linux, and Windows
Process & its States Lecture 5.
Mid Term review CSC345.
Process Description and Control
Lecture Topics: 11/1 General Operating System Concepts Processes
Processes Hank Levy 1.
Process Control B.Ramamurthy 2/22/2019 B.Ramamurthy.
Chapter 3: Processes.
CSE 451: Operating Systems Winter 2003 Lecture 4 Processes
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Processes in Unix, Linux, and Windows
CSE 451: Operating Systems Autumn 2009 Module 4 Processes
IT 344: Operating Systems Winter 2008 Module 4 Processes
Processes in Unix and Windows
CS510 Operating System Foundations
CSE 451: Operating Systems Autumn 2004 Module 4 Processes
Linux Process State Scheduling information Identifiers
Process Description and Control in Unix
Processes Hank Levy 1.
Process Description and Control in Unix
Chapter 3: Processes Process Concept Process Scheduling
Presentation transcript:

1 Chapter 4 Processes R. C. Chang

2 Linux Processes n Each process is represented by a task_struct data structure (task and process are terms that Linux uses interchangeably). n The task vector is an array of pointers to every task_struct data structure in the system. n The current, running, process is pointed to by the current pointer.

3 Task State n Running –The process is either running (it is the current process in the system) or it is ready to run n Waiting –The process is waiting for an event or for a resource. Linux differentiates between two types of waiting process; –Interruptible waiting processes can be interrupted by signals

4 Task State –uninterruptible waiting processes are waiting directly on hardware conditions and cannot be interrupted under any circumstances. n Stopped –The process has been stopped, usually by receiving a signal. A process that is being debugged can be in a stopped state. n Zombie – This is a halted process which, for some reason, still has a task_struct data structure in the task vector. It is what it sounds like, a dead n process.

5 Process Information n Scheduling Information n Identifier –Process id n Inter-Process Information n Links –ptree command

6 Process Information n Times and Timers –jiffies n File system n Virtual Memory n Process Specific Context –registers, stacks,...

7 Identifiers n uid, gid n effective uid and gid –setuid n files system effective uid and gid –NFS mounted files systems –saved uid and giPOSIX standard

8 Scheduling n Scheduler( ) –after putting current process to a wait queue –at the end of a system call n Select the most deserving process to run –Policy : Normal/RealTime Reatime : round robin, First in first out –Priority –rt_priority –counter amount of time (jiffies)

9 Scheduling n Scheduler( ) –kernel work : lightweight kernel thraeds –current process Round robin: it is put onto the back of the run queue. INTERRUPTIBLE and it has received a signal since the last time it was scheduled then its state becomes RUNNING. If the current process has timed out, then its state becomes RUNNING. If the current process is RUNNING then it will remain in that state. Processes that were neither RUNNING nor INTERRUPTIBLE are removed from the run queue.

10 Scheduling n Process Selection –Priority, Weight –Normal : Counter –Real Time : counter n Swap process (at the end of the scheduler) –save the context of the current process –load the context of new process –update page table entries

11 Scheduling in Multiprocessor Systems n One idle process per CPU n task_struct –processor / last_processor –processor mask

12 Files standard input 0 standard output 1 standard error 2

13 Virtual Memory

14 Creating a Process n Init_task –statically defined at kernel build time n Init thread –initial setting up of the system open system console, mount root file system… –execute system initialization program /etc/init, /bin/init, /sbin/init /etc/inittab : create new processes

15 New Process Creation n Fork or clone –A new task_struct (with the same content of old task_struct) –Share Resources increase resource count –Virtual Memory copy on write

16 Times and Timers n Times –each clock tick, the kernel updates the amount of time in jiffies (system and user mode) n Interval Timers –Real : SIGALRM –Virtual : This timer only ticks when the process is running: SIGVTALRM –Profile : running and system mode: SIGPROF

17 Executing Programs n Fork n Exec n Linux Binary Format –ELF, a.out, script

18 ELF(Executable and Linkable Format) C program “hello world” Two physical header Starting from 52 Executable code in the image virtual address size Data for the program data in file size : 2200 memory size : 4248 (2048 : initialized by the executing code

19 Load ELF Executable Image n Flush the process’s current image n set up in mm_struct and vm_struct n Load image when paging fault n ELF shared libraries –dynamic linker ld.ssso.1, libc.so.1,ld-linux.so.1 –link image at run time

20 Script Files n A typical script file start with:(interpreter) –#!/usr/bin/wish n Load interpreter and interpret the remaining script file