June 6, 2002Serguei A. Mokhov, 1 Salsa Theory Debrief 2 COMP346 - Operating Systems Tutorial 6 Edition 1.1, June 19, 2002.

Slides:



Advertisements
Similar presentations
1 Interprocess Communication 1. Ways of passing information 2. Guarded critical activities (e.g. updating shared data) 3. Proper sequencing in case of.
Advertisements

May 21, 2002Serguei A. Mokhov, 1 Some Theory Review COMP346/ Operating Systems Revision 1.2 September 30, 2003.
Operating Systems ECE344 Midterm review Ding Yuan
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.
CAS3SH3 Midterm Review. The midterm 50 min, Friday, Feb 27 th Materials through CPU scheduling closed book, closed note Types of questions: True & False,
Cpr E 308 Spring 2004 Recap for Midterm Introductory Material What belongs in the OS, what doesn’t? Basic Understanding of Hardware, Memory Hierarchy.
Computer Systems/Operating Systems - Class 8
CS444/CS544 Operating Systems Synchronization 2/16/2006 Prof. Searleman
Chapter 4: Threads. Overview Multithreading Models Threading Issues Pthreads Windows XP Threads.
ECE 526 – Network Processing Systems Design Software-based Protocol Processing Chapter 7: D. E. Comer.
Thursday, June 08, 2006 The number of UNIX installations has grown to 10, with more expected. The UNIX Programmer's Manual, 2nd Edition, June, 1972.
Chapter 2: Processes Topics –Processes –Threads –Process Scheduling –Inter Process Communication (IPC) Reference: Operating Systems Design and Implementation.
Avishai Wool lecture Priority Scheduling Idea: Jobs are assigned priorities. Always, the job with the highest priority runs. Note: All scheduling.
Concurrency. What is Concurrency Ability to execute two operations at the same time Physical concurrency –multiple processors on the same machine –distributing.
1 Concurrent and Distributed Systems Introduction 8 lectures on concurrency control in centralised systems - interaction of components in main memory -
Threads 1 CS502 Spring 2006 Threads CS-502 Spring 2006.
A. Frank - P. Weisberg Operating Systems Introduction to Tasks/Threads.
Race Conditions CS550 Operating Systems. Review So far, we have discussed Processes and Threads and talked about multithreading and MPI processes by example.
© 2004, D. J. Foreman 2-1 Concurrency, Processes and Threads.
CS 3013 & CS 502 Summer 2006 Threads1 CS-3013 & CS-502 Summer 2006.
Using Two Queues. Using Multiple Queues Suspended Processes Processor is faster than I/O so all processes could be waiting for I/O Processor is faster.
ThreadsThreads operating systems. ThreadsThreads A Thread, or thread of execution, is the sequence of instructions being executed. A process may have.
June 11, 2002Serguei A. Mokhov, 1 Deadlock COMP346 - Operating Systems Tutorial 5 Edition 1.1, June 15, 2002.
Processes Part I Processes & Threads* *Referred to slides by Dr. Sanjeev Setia at George Mason University Chapter 3.
Virtualization Technology Prof D M Dhamdhere CSE Department IIT Bombay Moving towards Virtualization… Department of Computer Science and Engineering, IIT.
CS 153 Design of Operating Systems Spring 2015 Midterm Review.
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Chapter 1 Computer System Overview Sections 1.1 to 1.6 Instruction exe cution Interrupt Memory hierarchy Cache memory Locality: spatial and temporal Problem.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
30 October Agenda for Today Introduction and purpose of the course Introduction and purpose of the course Organization of a computer system Organization.
Ihr Logo Operating Systems Internals & Design Principles Fifth Edition William Stallings Chapter 2 (Part II) Operating System Overview.
Processes Introduction to Operating Systems: Module 3.
CSE 451: Operating Systems Section 5 Midterm review.
1 Threads, SMP, and Microkernels Chapter Multithreading Operating system supports multiple threads of execution within a single process MS-DOS.
1 Interprocess Communication (IPC) - Outline Problem: Race condition Solution: Mutual exclusion –Disabling interrupts; –Lock variables; –Strict alternation.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
CS399 New Beginnings Jonathan Walpole. 2 Concurrent Programming & Synchronization Primitives.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
Threads-Process Interaction. CONTENTS  Threads  Process interaction.
CSE 153 Design of Operating Systems Winter 2015 Midterm Review.
1 Processes and Threads Part II Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Operating Systems Unit 2: – Process Context switch Interrupt Interprocess communication – Thread Thread models Operating Systems.
UDI Technology Benefits Slide 1 Uniform Driver Interface UDI Technology Benefits.
Concepts and Structures. Main difficulties with OS design synchronization ensure a program waiting for an I/O device receives the signal mutual exclusion.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
Tutorial 2: Homework 1 and Project 1
Kernel Design & Implementation
Chapter 4: Threads.
Processes and threads.
Sarah Diesburg Operating Systems COP 4610
Chapter 3: Process Concept
Threads and Data Sharing
CS703 - Advanced Operating Systems
Mid Term review CSC345.
Midterm review: closed book multiple choice chapters 1 to 9
Process Description and Control
Process Description and Control
Operating Systems Lecture 1.
Process Description and Control
Process Description and Control
Process Description and Control
February 5, 2004 Adrienne Noble
CS510 Operating System Foundations
CSE 153 Design of Operating Systems Winter 19
CS333 Intro to Operating Systems
Operating Systems Structure
CSE 153 Design of Operating Systems Winter 2019
In Today’s Class.. General Kernel Responsibilities Kernel Organization
Sarah Diesburg Operating Systems CS 3430
Presentation transcript:

June 6, 2002Serguei A. Mokhov, 1 Salsa Theory Debrief 2 COMP346 - Operating Systems Tutorial 6 Edition 1.1, June 19, 2002

June 6, 2002Serguei A. Mokhov, 2 Topics Device Drivers Mutual Exclusion Some Deadlock Processes fork() and exec() System Calls Processes vs. Threads, Take II Message Passing vs. System Calls

June 6, 2002Serguei A. Mokhov, 3 Device Drivers 1.Provide Common Interface (a layer of abstraction) 2.Execute privileged instructions 3.Part of the OS (Why? :-)) 4.Have two halves: Upper Half – Exposes 1. to the rest of OS Lower Half Provides Device-Specific implementation of 1 Interrupt handling

June 6, 2002Serguei A. Mokhov, 4 Device Drivers (2) Mapping independent I/O functions to device-dependent open() close() read() write() … Int handling, dev_open(), dev_close()… Buffers to sync data between the halves Upper half. Works at CPU’s speed Lower Half. Operates at device’s speed

June 6, 2002Serguei A. Mokhov, 5 Mutual Exclusion Possible Implementations: –General semaphores on top of counting ones –Using interrupts Drawbacks –ME violation –Starvation

June 6, 2002Serguei A. Mokhov, 6 Drivers Example: –LP driver

June 6, 2002Serguei A. Mokhov, 7 Mutual Exclusion Binary semaphores were implemented as separate entities for efficiency reasons [1]. General semaphores were using binary ones.

June 6, 2002Serguei A. Mokhov, 8 Mutual Exclusion What are the problems with the above? –Consider 2 V() and 2 P() operations executing concurrently: PVPV P() { V() { wait(mutex); wait(mutex); count – 1; count + 1; if (count < 0) { if (count <= 0) { signal(mutex); signal(delay); wait(delay); } } else { signal(mutex); signal(mutex); } }

June 6, 2002Serguei A. Mokhov, 9 Mutual Exclusion One P’s ran and got interrupted. Then one V ran till completion. Then the second P did as the first one. Then the second V ran till completion. Then… ? Imagine 100 P’s and V’s… P() { V() { wait(mutex); wait(mutex); count – 1; count + 1; if (count < 0) { if (count <= 0) { signal(mutex); signal(delay); wait(delay); } } else { signal(mutex); signal(mutex); } }

June 6, 2002Serguei A. Mokhov, 10 Mutual Exclusion To avoid the possible problem of the previous solution, we introduce interrupt operations. Looks OK, everybody is happy. BUT… what about multiprocessor systems? P() { V() { cli cli count – 1; count + 1; if (count < 0) { if (count <= 0) { wait(delay); signal(delay); } } sti sti }

June 6, 2002Serguei A. Mokhov, 11 Some Scheduling The scheduler places processes blocked on a semaphore in a queue. If semaphore queues are handled using: –FIFO –Stack (LIFO) How about fairness and starvation properties of each method?

June 6, 2002Serguei A. Mokhov, 12 Memory Stuff Tutorials 7 and 8 from Paul and Tony Locality of Reference Model –Keep the pages for a given scope of code (e.g. function), locality, with all instructions, variables (either local or global) used by these instructions in the memory to avoid thrashing. –There can be several localities –Localities change over time, can overlap.

June 6, 2002Serguei A. Mokhov, 13 Memory Stuff Locality – Self Referencing Code (loops): –Prof. Aiman Hanna: “Locality in this context just means that the process is referencing the same piece of code (that is why the page that is used will be used many times). The most obvious way to have code locality are loops, since the executed lines may go again and again. Since these lines belong to the same page(s), these pages will be kept (not considered for replacement). This is why LFU will behave best at that locality points.”

June 6, 2002Serguei A. Mokhov, 14 Deadlock A system: –Three concurrent processes –Five resources of the same type Each process needs to acquire three resources to terminate. Upon termination a process releases all resources back to the system. Is there a possibility of a deadlock?

June 6, 2002Serguei A. Mokhov, 15 Deadlock p1p2p3

June 6, 2002Serguei A. Mokhov, 16 Deadlock p1p2p3

June 6, 2002Serguei A. Mokhov, 17 Deadlock p1p2p3

June 6, 2002Serguei A. Mokhov, 18 Deadlock p1p2p3

June 6, 2002Serguei A. Mokhov, 19 Deadlock p1p2p3 ? ?

June 6, 2002Serguei A. Mokhov, 20 Processes Again fork() and exec() – Review COMP229 slides from the past term.

June 6, 2002Serguei A. Mokhov, 21 Threads vs. Processes, Take II Do the threads really “speed up” process’ execution? –Define “speed up” and the kind of threads (user, kernel, LWP) you’re talking about –Consider the task of the running program. Does it exploit parallelism?

June 6, 2002Serguei A. Mokhov, 22 Threads vs. Processes, Take II In which circumstances one’s better off with processes rather than threads? Answer this: –What’s your task and how parallel is it? –Robustness? (e.g. PostgreSQL RDBMS) What if a thread “crashes”? –Complexity of implementation? –Synchronization? –Is really “speed up” achieved using threads?

June 6, 2002Serguei A. Mokhov, 23 Message Passing vs. System Calls Where does one outperform the other? Good question because they do different things. Message passing is an IPC facility, system calls have a wider spectrum of use (subset may be used in IPC, obviously). Consider this (assuming IPC): –Message passing services run in the user space outside of the kernel. –System calls execute in the kernel on behalf of the process. –Messages have limitations on size. –System calls imply mode switch and more overhead –Messages are not necessarily received immediately. Now looking at the above tell: which one is more secure? Which one is more flexible? What are the space/time requirements in each?