ICS 143 Principles of Operating Systems

Slides:



Advertisements
Similar presentations
Threads Irfan Khan Myo Thein What Are Threads ? a light, fine, string like length of material made up of two or more fibers or strands of spun cotton,
Advertisements

Process Concept n An operating system executes a variety of programs: –Batch system – jobs –Time-shared systems – user programs or tasks n Textbook uses.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Operating System Concepts
Process Concept An operating system executes a variety of programs
Processes Part I Processes & Threads* *Referred to slides by Dr. Sanjeev Setia at George Mason University Chapter 3.
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.
Silberschatz and Galvin  Operating System Concepts Module 4: Processes Process Concept Process Scheduling Operation on Processes Cooperating.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-1 Process Concepts Department of Computer Science and Software.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 4 Process Slide 1 Chapter 4 Process.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Dr. T. Doom 4.1 CEG 433/633 - Operating Systems I Chapter 4: Processes What is a process? –Informally: A program in execution  Analogies: A script Vs.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations on Processes Cooperating.
Processes – Part I Processes – Part I. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Review on OSs Upon brief introduction of OSs,
Chapter 4: Threads. 4.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th edition, Jan 23, 2005 Chapter 4: Threads Overview Multithreading.
CS212: OPERATING SYSTEM Lecture 2: Process 1. Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
PREPARED BY : MAZHAR JAVED AWAN BSCS-III Process Communication & Threads 4 December 2015.
Processes & Threads Introduction to Operating Systems: Module 5.
Operating Systems (CS 340 D) Dr. Abeer Mahmoud Princess Nora University Faculty of Computer & Information Systems Computer science Department.
Processes. Process Concept Process Scheduling Operations on Processes Interprocess Communication Communication in Client-Server Systems.
Lecture 4: Processes & Threads. Lecture 4 / Page 2AE4B33OSS Silberschatz, Galvin and Gagne ©2005 Contents The concept of Process Process states and life-cycle.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Processes.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 3: Processes Process Concept Process Scheduling Operations.
Operating System Concepts
Operating System Components) These components reflect the services made available by the O.S. Process Management Memory Management I/O Device Management.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Introduction to threads
OPERATING SYSTEM CONCEPT AND PRACTISE
Lecture 3 Process.
Processes and threads.
Principles of Operating Systems
Chapter 3: Process Concept
Topic 3 (Textbook - Chapter 3) Processes
Operating System Concepts
Operating Systems (CS 340 D)
Sujata Ray Dey Maheshtala College Computer Science Department
Chapter 2 Processes and Threads Today 2.1 Processes 2.2 Threads
Process Management Presented By Aditya Gupta Assistant Professor
Chapter 3: Process Concept
Chapter 4 Threads.
Chapter 3: Processes Source & Copyright: Operating System Concepts, Silberschatz, Galvin and Gagne.
Chapter 3: Processes.
Intro to Processes CSSE 332 Operating Systems
Operating Systems (CS 340 D)
Threads & multithreading
Operating System Concepts
Chapter 3: Processes.
Process Virtualization. Process Process is a program that has initiated its execution. A program is a passive entity; whereas a process is an active entity.
Operating Systems Processes and Threads.
Chapter 4: Threads.
Chapter 4: Threads.
Chapter 4: Processes Process Concept Process Scheduling
Lecture 2: Processes Part 1
Recap OS manages and arbitrates resources
Operating Systems Lecture 6.
Process & its States Lecture 5.
Mid Term review CSC345.
Chapter 3: Processes.
Operating System Concepts
Sujata Ray Dey Maheshtala College Computer Science Department
Still Chapter 2 (Based on Silberchatz’s text and Nachos Roadmap.)
Chapter 3: Processes.
CS510 Operating System Foundations
Outline Chapter 2 (cont) Chapter 3: Processes Virtual machines
Chapter 3: Processes Process Concept Process Scheduling
Chapter 3: Process Concept
Presentation transcript:

ICS 143 Principles of Operating Systems Discussion Section

CS 143A Discussion TA: Kyle Benson, E-Mail: kebenson@uci.edu TA: Qiuxi Zhu, E-Mail: qiuxiz@ics.uci.edu TA: Joe Nash, E-Mail: jmnash@uci.edu Regarding emails General questions of a non-personal nature should be directed to Piazza forum, NOT email Please add “CS143A” to the subject line for personal/sensitive email questions Office hours: Tuesdays 1:00p-2:30p in DBH 4013 Same time/location each week, different TA/grader. 11/19/2018

Homework #1 Homework #1 out now on class website Due Thursday April 14, 11:55pm via EEE Dropbox This is the submission deadline! Please submit single PDF file No late submissions will be accepted Ask questions on Piazza 11/19/2018

Process =? Program Program Process main () { …; } A() { … main () { …; Heap Stack A main 11/19/2018

Process Process - a program in execution A process contains process execution proceeds in a sequential fashion A process contains program counter, registers Memory: text section, stack, data section and heap Other resources: e.g. opened files Security attributes 11/19/2018

Process State A process changes state as it executes. Process exits when done. Process is admitted to system, has all resources, ready to compete for CPU Maybe process is not done, but interrupt forces it stop new admitted interrupt I/O or event completion Scheduler dispatch event wait exit ready running terminated waiting Process is being created, may have some resources already Process is now running (assigned by scheduler) Event or I/O complete: go back to ready (CPU might not be ready yet) Waiting on I/O or event (trigger for some other process to go from ready to running) 11/19/2018

Process Control Block Process Control Block Contains information associated with each process Process State - e.g. new, ready, running etc. Process Number – Process ID Program Counter - address of next instruction to be executed CPU registers - general purpose registers, stack pointer etc. CPU scheduling information - process priority, pointer Memory Management information - base/limit information Accounting information - time limits, I/O status information 11/19/2018

Context Switching 11/19/2018

Schedulers Long-term scheduler (or job scheduler) - selects which processes should be brought into the ready queue. invoked very infrequently (seconds, minutes); may be slow. controls the degree of multiprogramming Short term scheduler (or CPU scheduler) - selects which process should execute next and allocates CPU. invoked very frequently (milliseconds) - must be very fast Medium Term Scheduler swaps out process temporarily balances load for better throughput 11/19/2018

Process Profiles I/O bound process CPU bound process spends more time in I/O, short CPU bursts, CPU underutilized. CPU bound process spends more time doing computations; few very long CPU bursts, I/O underutilized. The right job mix: Long term scheduler - admits jobs to keep load balanced between I/O and CPU bound processes Medium term scheduler – ensures the right mix (by sometimes swapping out jobs and resuming them later) 11/19/2018

Linux Process Creation fork() creates a copy of the current process exec() can be called after fork() to load a new program to replace the current one 11/19/2018

Threads Processes do not share resources well high context switching overhead A thread (or lightweight process) Basic unit of CPU utilization; it consists of: program counter, register set and stack space A thread shares the following with peer threads: code section, data section and OS resources (open files, signals) Collectively called a task. Heavyweight process is a task with one thread. 11/19/2018

Processes and Threads 11/19/2018

Processes and Threads 11/19/2018

Types of Threads Kernel-supported threads User-level threads Windows NT, Linux, Mac OS X, UNIX, Solaris, … User-level threads POSIX pthreads, Java threads Hybrid approach that implements both 11/19/2018

Kernel Threads Supported by the Kernel Native threads supported directly by the kernel Every thread can run or block independently One process may have several threads waiting on different things Downside of kernel threads: a bit expensive Need to make a crossing into kernel mode to schedule Examples Windows XP/2000, Linux, Tru64 UNIX, Mac OS X, Solaris, Mach, OS/2 11/19/2018

User Threads Supported above the kernel, via a set of library calls at the user level. Thread management done by user-level threads library User program provides scheduler and thread package May have several user threads per kernel thread Advantages Cheap, Fast Threads do not need to call OS and cause interrupts to kernel Disadvantages: If kernel is single threaded, system call from any thread can block the entire task Example thread libraries: POSIX Pthreads, Win32 threads, Java threads 11/19/2018

Multi-? Multiprocessing Multiprogramming Multithreading Multiple CPUs Multiple processes running concurrently Multithreading Multiple threads per process 11/19/2018

Cooperating Processes Concurrent Processes can be Independent processes cannot affect or be affected by the execution of another process. Cooperating processes can affect or be affected by the execution of another process. Advantages of process cooperation: Information sharing Computation speedup Modularity Convenience (e.g. editing, printing, compiling) Concurrent execution requires process communication and process synchronization 11/19/2018

Inter-process Communication Processes have separated address spaces How do processes communicate and synchronize with others? Shared memory Mapping addresses to commonly accessible memory Messaging system send() and receive() messages Can be used over network Can be used simultaneously in a single OS or a single process 11/19/2018