The ‘process’ abstraction

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

Process management Information maintained by OS for process management  process context  process control block OS virtualization of CPU for each process.
The ‘thread’ abstraction A look at the distinction between the idea of a ‘process’ and the concept of a ‘thread’
Chapter 5 Processes and Threads Copyright © 2008.
Process Description and Control Module 1.0. Major Requirements of an Operating System Interleave the execution of several processes to maximize processor.
“Virtual” Memory How does the OS kernel provide “private” and “shared” memory areas to multiple concurrent processes?
The kernel’s task list Introduction to process descriptors and their related data-structures for Linux kernel version
Introduction to Operating Systems – Windows process and thread management In this lecture we will cover Threads and processes in Windows Thread priority.
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.
The kernel’s task list Introduction to process descriptors and their related data-structures for Linux kernel version
Process in Unix, Linux and Windows CS-3013 C-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
CS-502 Fall 2006Processes in Unix, Linux, & Windows 1 Processes in Unix, Linux, and Windows CS502 Operating Systems.
CSE451 Processes Spring 2001 Gary Kimura Lecture #4 April 2, 2001.
Linux Memory Management How does the Linux kernel keep track of the Virtual Memory Areas that each process uses?
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.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
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.
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,
CE Operating Systems Lecture 11 Windows – Object manager and process management.
REVIEW OF COMMONLY USED DATA STRUCTURES IN OS. NEEDS FOR EFFICIENT DATA STRUCTURE Storage complexity & Computation complexity matter Consider the problem.
Process by Dr. Amin Danial Asham. References Operating System Concepts ABRAHAM SILBERSCHATZ, PETER BAER GALVIN, and GREG GAGNE.
Multiprogramming. Readings r Silberschatz, Galvin, Gagne, “Operating System Concepts”, 8 th edition: Chapter 3.1, 3.2.
Processes and Process Control 1. Processes and Process Control 2. Definitions of a Process 3. Systems state vs. Process State 4. A 2 State Process Model.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
Linux Processes Travis Willey Jeff Mihalik. What is a process? A process is a program in execution A process includes: –program counter –stack –data section.
1 Review of Process Mechanisms. 2 Scheduling: Policy and Mechanism Scheduling policy answers the question: Which process/thread, among all those ready.
4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING SUSE Lab.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
CSC 660: Advanced Operating Systems
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
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.
Copyright © Curt Hill More on Operating Systems Continuation of Introduction.
Processes David Ferry, Chris Gill CSE 522S - Advanced Operating Systems Washington University in St. Louis St. Louis, MO
Advanced Operating Systems CS6025 Spring 2016 Processes and Threads (Chapter 2)
Multiprogramming. Readings r Chapter 2.1 of the textbook.
Processes and threads.
Chapter 3: Processes.
Process Management Process Concept Why only the global variables?
Operating Systems •The kernel is a program that constitutes the central core of a computer operating system. It has complete control over everything that.
OPERATING SYSTEMS CS3502 Fall 2017
Lecture Topics: 11/1 Processes Process Management
Process Management Presented By Aditya Gupta Assistant Professor
Operating Systems: A Modern Perspective, Chapter 6
Chapter 3: Processes Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Processes David Ferry, Chris Gill
Process Realization In OS
Intro to Processes CSSE 332 Operating Systems
Process management Information maintained by OS for process management
Processes in Unix, Linux, and Windows
Chapter 15, Exploring the Digital Domain
PROCESS MANAGEMENT Information maintained by OS for process management
Process Description and Control
Lecture Topics: 11/1 General Operating System Concepts Processes
Processes Hank Levy 1.
Chapter 3: Processes.
Processes David Ferry CSCI 3500 – Operating Systems
Processes in Unix, Linux, and Windows
Implementing Processes, Threads, and Resources
CS510 Operating System Foundations
Processes Hank Levy 1.
Implementing Processes, Threads, and Resources
Processes David Ferry, Chris Gill, Brian Kocoloski
Chapter 3: Process Management
Presentation transcript:

The ‘process’ abstraction An introductory exploration of ‘process management’ as conducted by Linux

‘program’ versus ‘process’ A ‘program’ is a sequence of instructions It’s an algorithm, expressed in a computer language, but it does nothing on its own A ‘process’ is a succession of actions that are performed when a program executes It’s a dynamically changing entity, which has an existence over time, but it requires a processor and it uses various resources

Process management Some operating systems were designed to manage only one process at a time (e.g. CP/M, PC-DOS) But most modern systems are designed to manage multiple processes concurrently (e.g., Windows, UNIX/Linux) Not surprisingly, these latter systems are much more complex: they must cope with issues of ‘cooperation’ and ‘competition’

Tracking a ‘process’ As a process-manager, the OS must keep track of each process that is currently in existence, to facilitate cooperation among them and to mediate competing demands It uses some special data-structures to do this (with assistance from a timing-device) The various processes ‘take turns’ using the processor’s time, and share access to the system’s peripheral hardware devices

The process control block The OS kernel creates a data-structure for each current process, known as a process control block or task record or ‘task_struct’ In Linux, these structures are all arranged in a doubly-linked list (i.e., the ‘task list’) task list task struct task struct task struct task struct

Several dozen fields Dozens of separate items of information are kept in a Linux ‘task_struct’; e.g.: pid; // process ID-number state; // current task-state priority; // current task-priority start_time; // time when task was created sleep_time; // time when task began sleeping . . . // … many more items … This info is used by the Linux ‘scheduler’

The ‘states’ of a Linux process A process can be in one of several states: 0: TASK_RUNNING 1: TASK_INTERRUPRIBLE 2: TASK_UNINTERRUPTIBLE 4: TASK_ZOMBIE 8: TASK_STOPPED

state-transition diagram UNINTERRUPTIBLE INTERRUPTIBLE RUNNING create event schedule wait signal preempt CPU signal terminate STOPPED ZOMBIE

A process needs ‘resources’ Each task may acquire ownership of some system resources while it is executing For example, a task needs to use some system memory (code, data, heap, stack) And a task typically needs to read or write to some disk-files or to peripheral devices Usually a task will want to call subroutines which belong to a shared runtime library Every task needs to use some CPU time

The OS is a ‘resource manager’ Sometimes a task is temporarily granted ‘exclusive’ access to a system resource (e.g., each task has its own private stack) But often a task will be allowed to ‘share’ access to a system resource (e.g., many processes call the same runtime libraries) Acquisition of resources by a task is kept track of within the task’s ‘task_struct’

Examples: memory and files The ‘task_struct’ record has fields (named ‘mm’ and ‘files’) which hold pointers to OS structures (‘mm_struct’ and ‘files_struct’) that describe the particular memory-areas and files which the task currently ‘owns’ task_struct mm_struct mm files_struct files

Demo-module: ‘tasklist.c’ This kernel module creates a pseudo-file (named ‘/proc/tasklist’) that will display a list of all the current processes It traverses the linked-list of all the process control blocks (i.e., the ‘task_struct’ nodes) It prints each task’s pid, state, and name It’s a ‘big’ proc-file (over 3K), so it needs to utilize the ‘start’, ‘offset’, ‘count, and ‘eof’ parameters to the ‘proc_read’ function

Demo: ‘sleep.c’ For kernel version 2.4.26, Linux stores two timestamp-values in every ‘task_struct’: start_time; // time when task was created sleep_time; // time when task went to sleep The ‘/proc/sleep’ file shows each process ‘state’ and ‘sleep_time’ EXERCISE: Add the needed code to show each process’s ‘start_time’, too (‘big’ proc)