Today From threads to file systems

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

CAS3SH3 Midterm Review. The midterm 50 min, Friday, Feb 27 th Materials through CPU scheduling closed book, closed note Types of questions: True & False,
Chapter 6: Process Synchronization
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 6: Process Synchronization.
Interprocess Communication
Cpr E 308 Spring 2004 Recap for Midterm Introductory Material What belongs in the OS, what doesn’t? Basic Understanding of Hardware, Memory Hierarchy.
1 Created by Another Process Reason: modeling concurrent sub-tasks Fetch large amount data from network and process them Two sub-tasks: fetching  processing.
Computer Systems/Operating Systems - Class 8
Review: Chapters 1 – Chapter 1: OS is a layer between user and hardware to make life easier for user and use hardware efficiently Control program.
CS533 Concepts of Operating Systems Class 5 Integrated Task and Stack Management.
1 Threads CSCE 351: Operating System Kernels Witawas Srisa-an Chapter 4-5.
CS444/CS544 Operating Systems Review: Synchronization 3/9/2007 Prof. Searleman
Chapter 2: Processes Topics –Processes –Threads –Process Scheduling –Inter Process Communication (IPC) Reference: Operating Systems Design and Implementation.
Avishai Wool lecture Introduction to Systems Programming Lecture 4 Inter-Process / Inter-Thread Communication.
Review: Process Management Objective: –Enable fair multi-user, multiprocess computing on limited physical resources –Security and efficiency Process: running.
5.6 Semaphores Semaphores –Software construct that can be used to enforce mutual exclusion –Contains a protected variable Can be accessed only via wait.
1 CS 333 Introduction to Operating Systems Class 2 – OS-Related Hardware & Software The Process Concept Jonathan Walpole Computer Science Portland State.
5.6.2 Thread Synchronization with Semaphores Semaphores can be used to notify other threads that events have occurred –Producer-consumer relationship Producer.
CMPT 300: Operating Systems Review THIS REIVEW SHOULD NOT BE USED AS PREDICTORS OF THE ACTUAL QUESTIONS APPEARING ON THE FINAL EXAM.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
Race Conditions CS550 Operating Systems. Review So far, we have discussed Processes and Threads and talked about multithreading and MPI processes by example.
A. Frank - P. Weisberg Operating Systems Introduction to Cooperating Processes.
G Robert Grimm New York University Scheduler Activations.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
General What is an OS? What do you get when you buy an OS? What does the OS do? What are the parts of an OS? What is the kernel? What is a device.
Chapter 4 Threads, SMP, and Microkernels Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design.
CSE 451: Operating Systems Section 10 Project 3 wrap-up, final exam review.
Cosc 4740 Chapter 6, Part 3 Process Synchronization.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
1 Processes, Threads, Race Conditions & Deadlocks Operating Systems 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,
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Introduction to Concurrency.
Cpr E 308 Spring 2004 Real-time Scheduling Provide time guarantees Upper bound on response times –Programmer’s job! –Every level of the system Soft versus.
Chapter 1 Computer System Overview Sections 1.1 to 1.6 Instruction exe cution Interrupt Memory hierarchy Cache memory Locality: spatial and temporal Problem.
File Management Chapter 12. File Management File management system is considered part of the operating system Input to applications is by means of a file.
1 File Systems: Consistency Issues. 2 File Systems: Consistency Issues File systems maintains many data structures  Free list/bit vector  Directories.
30 October Agenda for Today Introduction and purpose of the course Introduction and purpose of the course Organization of a computer system Organization.
Copyright ©: University of Illinois CS 241 Staff1 Threads Systems Concepts.
OPERATING SYSTEM SUPPORT DISTRIBUTED SYSTEMS CHAPTER 6 Lawrence Heyman July 8, 2002.
File System Implementation
Silberschatz, Galvin and Gagne  Operating System Concepts Operating Systems 1. Overview 2. Process Management 3. Storage Management 4. I/O Systems.
Solutions for the First Quiz COSC 6360 Spring 2014.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
1 Rutgers UniversityCS 416: Operating Systems Final exam details December 22, pm-3pm. Venue: SEC 118. Tips: Spend time reading the questions before.
CS1253- OPERATING SYSTEMS. SYLLABUS UNIT I PROCESSES AND THREADS 9 Introduction to operating systems – Review of computer organization – Operating.
1/31/20161 Final Exam Dec 10. Monday. 4-7pm. Phelp 1160 Similar to midterm The exam is closed book. You can bring 2 page of notes (double sided) Nachos.
MINIX Presented by: Clinton Morse, Joseph Paetz, Theresa Sullivan, and Angela Volk.
1 Threads, SMP, and Microkernels Chapter 4. 2 Process Resource ownership - process includes a virtual address space to hold the process image Scheduling/execution-
Threads prepared and instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University 1July 2016Processes.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Chapters 3 and 5 Possible questions
Introduction to Kernel
Processes and threads.
Applied Operating System Concepts -
Protection of System Resources
Section 10: Last section! Final review.
File Systems Directories Revisited Shared Files
COMS Prelim 1 Review Session
Process Description and Control
CSE451 - Section 10.
Concurrency: Mutual Exclusion and Process Synchronization
Operating Systems Lecture 1.
Major Topics in Operating Systems
Process Description and Control
February 5, 2004 Adrienne Noble
Last section! Project 4 + EC due tomorrow Today: Project 4 questions
CSE451 - Section 10.
BANKER’S ALGORITHM Prepared by, Prof
Presentation transcript:

Today From threads to file systems Final Review Today From threads to file systems

Threads Threads motivation and concept Threads and processes User, kernel-level and hybrid threads Complications with threads Q: If a multithreaded process forks, a problem occurs if the child gets copies of all the parent’s threads. Suppose that one of the original threads was waiting for keyboard input. Now two threads are waiting for keyboard input, one in each process. Does this problem ever occur in single-threaded processes? Q: In a system using user-level threads, is there one stack per thread or one stack per process? What about when kernel-level threads are used? Why or why not? Answer: No. If a single-threaded process is blocked on the keyboard, it cannot fork. Answer: Each thread calls procedures on its own, so it must have its own stack for the local variables, return addresses and so on. This is equally true for user-level as for kernel-level threads.

Thread synchronization Race conditions and critical sections Requirements for a solution Locks and lock implementation Disabling interrupts and TSL Busy waiting, priority inversion and sleeping Basic lock-based data structures Q: Can two threads in the same process synchronize using a kernel semaphore if the threads are implemented by the kernel? What if they are implemented in user space? Assume that no threads in any other processes have access to the semaphores. Answer: With kernel threads, a thread can block on a semaphore and the kernel can run some other thread in the same process. Consequently, there is no problem using semaphores. With user-level threads, when one thread blocks on a semaphore, the kernel thinks the entire process is blocked and does not run it ever again. Consequently, the process fails.

Synchronization II Condition variables Semaphores Bounded buffer problem Reader-writers problem Issues with semaphores Monitors Q: Give a sketch of how an operating system that can disable interrupts could implement semaphores. Q: Write (pseudocode) a monitor that implements an alarm clock that enables a calling program to delay itself for a specified number of time units (ticks). You may assume the existence of a real hardware clock that invokes a procedure tick in your monitor at regular intervals. To do a semaphore operation, the OS will first disable interrupts. Then it can read the value of the semaphore. If it is doing a DOWN and the semaphore is equal to zero, it puts the calling process on a list of blocked processes associated with the semaphore. If doing an UP, it must first check to see if there are processes blocked in the semaphore. If there are, one of them is removed from the list and made runnable. When all these operations have been completed, interrupts can be enabled again.

Monitor for an alarm clock monitor alarm { condition c; void delay(int ticks) { int begin_time = read_clock(); while (read_clock() < begin_time + ticks) c.wait(); } void tick() { c.broadcast();

Deadlocks Deadlock definition Condition for deadlocks Modeling deadlocks Deadlock detection and recovery Dynamic deadlock avoidance Deadlock prevention Q: A system has two processes and three identical resources. Each process needs a maximum of two resources. Is deadlock possible? Explain your answer. The system is deadlock free. Suppose that each process has one resource. There is one resource free. Either process can ask for it, get it and terminate releasing both resources it holds. Thus, deadlock is impossible.

I/O Principles of I/O hardware I/O software layers Ways I/O can be done Disks Disk scheduling RAID Q: A computer manufacturer decides to redesign the partition table of a Pentium hard disk to provide more than four partitions. What are some consequences of this change? One obvious consequence is that no existing operating system will work because they all look there to see where the disk partitions are. Changing the format of the partition table will cause all operating systems to fail.

File systems interface File system abstractions – files and directories Implementing files Implementing directories Protection Q: A key issue when designing a file system is deciding how to keep track of which disk block goes with which file. Of the approaches discussed in class, which one would you choose to maximize efficiency in terms of speed of access, use of storage space, and ease of updating (adding, deleting, modifying) when the data is: Updated very infrequently and accessed frequently in random order. Updated frequently and accessed in its entirety relatively frequently. Updated frequently and accessed frequently in random order. A: Continual allocation B: Linked list C: Either i-node or FATs

File systems implementation Early FS examples – CP/M, MSDOS, Original Unix FFS Fsck and journaling Log file system Q: In UNIX System V, the length of a block is 1Kbyte and each block can hold a total of 256 block addresses. Using the i-node scheme, what is the maximum size of a file? (Remember UNIX System V uses three levels of indirection) Q: How many disk operations are needed to fetch the i-nod e for the file /home/fabianb/courses/eecs343/final10.tex? Assume that the i-node for the root directory is in memory, but nothing else along the path is in memory. Also, assume that all directories fit in one disk block. The i-node itself stores the addresses of the first 10 data blocks. For larger files, the last three addresses point to a single, a double and a triple indirect block. With each block holding 256 block addresses, the maximum file size is $(10 + 256) * 1 Kbyte + 256^2 * 1 Kbyte + 256^3 * 1 Kbyte \approx 16 Gbytes. Directory for / i-node for /home Directory for /home i-node for /home/fabianb Directory for /home/fabianb i-node for /home/fabianb/courses Directory for /home/fabianb/courses i-node for /home/fabianb/courses/eecs343 Directory for /home/fabianb/courses/eecs343 i-node for /home/fabianb/courses/eecs343/final10.tex

Research papers Scheduler Activations: Effective Kernel Support for the User-Level Management of Parallelism, T. Anderson et al., Proc. of SOSP 1991 Experiences with Processes and Monitors in Mesa, B. Lampson and D. Redell, CACM 1980 Design and implementation of the log-structured file system, M. Rosenblum and J. Ousterhout, Proc. of SOSP 1991