Operating Systems

Total Page:16

File Type:pdf, Size:1020Kb

Operating Systems Outline • Introduction Operating Systems • Process management • Interrupts TDTS10 • Memory management • File system • Device drivers Erik Larsson • Networking (TCP/IP, UDP) Department of Computer Science • Security (Process/Memory protection) • I/O 2 Outline Outline • An Operating System (OS) is software • For hardware functions such as input (program) running on the computer and output and memory allocation, the (hardware) OS acts as an intermediary between application programs and the • The objective of the OS is to: computer hardware • manage the hardware resources of the computer system, and • The application code (software) is usually executed directly by the • provide services for the execution of application software. hardware (computer) but will frequently call the OS or be • Almost any system that contains a interrupted by it. computer has an OS—from cellular phones and video game consoles to • Note: an OS is not needed to execute supercomputers and web servers. a program. Some game consoles runs directly on the hardware. 3 4 Examples UNIX • UNIX • Ken Thompson and Dennis M. Ritchie • Windows • Turing award (“Nobel prize for • Other computer science”), 1983 • For their development of generic operating systems theory and specifically for the implementation of the UNIX operating system • Also • Ken Thompson developed C at Bell Labs and Go at Google Inc. • Dennis M. Ritchie developed C at Bell Labs 5 6 UNIX Linux • Linus Benedict Torvalds, born 1969, Finland • Wanted to learn OS, developed an OS • Linus' Law: Given a large enough beta-tester and co-developer base, almost every problem will be characterized quickly and the fix will be obvious to someone. • (Edsger W. Dijkstra: Program testing can be used to show the presence of bugs, but never to show their absence!) 7 8 Windows 1 • MS-DOS (Microsoft Disk Operating System) (~1980) • Target: Single user on PC (X86-architectures), not network 2 connected • Effect: Low security • Windows 1.0 (1985) • Windows 95, 98, 2000, XP, Vista, 7, 8? 4 3 9 10 Windows Other • Digital Equipment Corporation (DEC): OpenVMS (Open Virtual Memory System • Microsoft/IBM: OS/2 • Enea: Enea OSE • Nokia: Symbian • Google: Android 11 12 What does the OS do? 1. Process management • Process management • Execute program is a main task of the OS • Interrupts • A program (SW) needs resources to execute • Memory management • Programs alter between CPU and I/O cycles • File system • To increase CPU utilization, multiprogramming (time sharing, • Device drivers multi-tasking) – letting more than one program active – is proposed • Networking (TCP/IP, UDP) • OS regains control of the processor during a program’s • Security (Process/Memory protection) execution: • I/O • The process issues a system call (sometimes called a software interrupt); for example, an I/O request occurs requesting to access a file on hard disk. • A hardware interrupt occurs; for example, a key was pressed on the keyboard, or a timer runs out (used in pre-emptive multitasking). 13 14 Process model Process model • Two-state (Running and Not Running) • The scheduler picks one process from the Not Running queue and let it execute on the CPU. At interrupt (for example at end of time slice), a context switch takes place and a new program is loaded to the CPU • Three-state (Running, Ready, Blocked) • A drawback of the two-state model is that the CPU stays idle when a process does I/O operations. A new state (Blocked) is introduced). • Five-state (Running, Ready, Blocked, Ready suspended, Blocked suspended) • To handle virtual memories (for example move a process from primary memory to secondary memory), more states are needed 15 16 Scheduler Scheduling • Long-term scheduler – decides which jobs can enter the ready • MS-DOS– non multi-task system; hence, no scheduler queue • Windows 3.1 - non-preemptive scheduler (did not interrupt • Mid-term scheduler – decides which jobs shall be in primary programs) (main) memory and which shall be in the secondary memory • Windows NT, Linux, MacOS - multilevel feedback queue, • Short-term scheduler – decides which job to execute at any time • Algorithms: • First In First Out • Shortest Job First • Priority based scheduling • Round-robin scheduling • Multilevel Queue scheduling 17 18 Program execution Context switch 19 20 Process control block 2. Interrupts • Process Control Block (PCB, also called Task Controlling Block • Interrupts are important to implement time-sharing OS or Task Struct): a data structure containing the information • An interrupt makes the processor: needed to manage a particular process. • Save its state • Typical content: • Execute interrupts handling sequence • The identifier of the process (a process identifier, or PID) • Interrupts • Register values for the process including, notably, the program counter and stack pointer values for the process. • Hardware interrupts • The address space for the process • Software interrupts • Priority • Process accounting information, such as when the process was last run, how much CPU time it has accumulated, etc. • I/O Information (i.e. I/O devices allocated to this process, list of Resource (hard disk, opened files, etc) printer, ….) 21 22 Timer Interrupt CPU 3. Memory management 4. File system • A multiprogramming operating system control the usage of the • How keep track on all bits? memory so that each program has its part and do not interfere • Typically, you cannot address an individual bit (overhead with other programs becomes too large). • Relocation • Files and directories • be able to relocate programs in memory and handle memory • Examples: File Allocation Table (FAT), New Technology File references and addresses in the code of the program so that they always point to the right location in memory System (NTFS) • Memory protection • processes should not be able to reference the memory for another process without permission • Sharing • sometime different processes need to be able to share information and therefore access the same part of memory 23 24 Inode 5. Device drivers • Device driver (software) interface with hardware, such as: • Printers, video adapters, network cards, sound cards, low- • Each file in Unix has an Inode bandwidth I/O buses of various sorts (for pointing devices such as • Example: mice, keyboards, USB, etc.), computer storage devices such as hard disk, CD-ROM and floppy disk buses (ATA, SATA, SCSI). • Twelve pointers that directly point to blocks of the file's data (direct pointers) • Execution: kernel-mode or user-mode (to be discussed soon)? • One singly indirect pointer (a pointer that points to a block of pointers that then point to blocks of the file's data) • One doubly indirect pointer (a pointer that points to a block of pointers that point to other blocks of pointers that then point to blocks of the file's data) • One triply indirect pointer (a pointer that points to a block of pointers that point to other blocks of pointers that point to other blocks of pointers that then point to blocks of the file's data) 25 26 6. Networking 7. Security • Communication media • Microsoft targeted single user systems with no network • Wired technologies connection; hence, security was not an issue • Twisted pair (telephone wire), coaxial cable (TV), optical fiber • UNIX targeted multi-user (multitasking); hence, designed in a • Wireless technologies more secure way • WLAN, Bluetooth • Communications protocol • Ethernet (IEEE 802) • Internet Protocol Suite (Transfer Control Protocol, is one of the core protocols of the Internet Protocol Suite (TCP/IP)) 27 28 8. Input/Output Rings • I/O is all communication with the outside of the computer • Rings is hardware support to give protection • Examples – keyboards, monitors, discs, printers • Typically two modes: user-mode and supervisor-mode • MS-DOS – only supervisor-mode • Windows, Linux – supervisor and user mode 29 30 Kernel Things to be handled….. • The kernel is the main component of the OS. It acts as the interface • Assume 10 equal study rooms in a library. To request one room, between programs (applications) students puts request at front counter. At front counter, a variable is and the hardware. decremented at requests and incremented when a room is free. If no room is free, students form a queue. • Microkernel or monolithic kernel (Tanenbaum–Torvalds debate) • Solutions must handle: • requesting a resource and forgetting to release it, • releasing a resource that was never requested, • holding a resource for a long time without needing it, or • using a resource without requesting it first. • Avoid: Deadlock/starvation • When two trains approach each other at a crossing, both shall come to a full stop and neither shall start up again until the other has gone (Law in Kansas) 31 32 Semaphores Atomic operations Semaphores (Edsger Dijkstra) • If S>0 then S=S-1 corresponds to: Two operations: 1. Read S V stands for verhogen ("increase”) 2. If S>0 then S=S-1 function V(semaphore S, integer I): 3. Write S [S ! S + I] • S is a common variable that can be read by anyone. One P stands for the portmanteau prolaag, short resource (S=0 or 1). for probeer te verlagen, literally "try to reduce” • S=1 (resource is free) function P(semaphore S, integer I): • Process A Process B repeat: [if S >= I: • Read S //S=1 S ! S – I • Context switch (A->B) break] • Read S //S=1 P and V must be atomic (test-and-set or turn of interrupt) 33 34 Problems Other problems • Five silent philosophers at a table do one • Cigarette smokers problem of two things: eating or thinking. While • Dining philosophers problem eating, two forks are needed and only forks next to a particular philosopher can • Readers-writers problem be used. • Sleeping barber problem • Problems: • Producers-consumers problem • Deadlock – example: if each philosopher picks left fork and then waits for right fork • Starvation – example: if a philosopher picks left fork and keeps it for no longer than five minutes 35 36 www.liu.se .
Recommended publications
  • Static Analysis of a Concurrent Programming Language by Abstract Interpretation
    View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by Concordia University Research Repository STATIC ANALYSIS OF A CONCURRENT PROGRAMMING LANGUAGE BY ABSTRACT INTERPRETATION Maryam Zakeryfar A thesis in The Department of Computer Science and Software Engineering Presented in Partial Fulfillment of the Requirements For the Degree of Doctor of Philosophy (Computer Science) Concordia University Montreal,´ Quebec,´ Canada March 2014 © Maryam Zakeryfar, 2014 Concordia University School of Graduate Studies This is to certify that the thesis prepared By: Mrs. Maryam Zakeryfar Entitled: Static Analysis of a Concurrent Programming Language by Abstract Interpretation and submitted in partial fulfillment of the requirements for the degree of Doctor of Philosophy (Computer Science) complies with the regulations of this University and meets the accepted standards with respect to originality and quality. Signed by the final examining committee: Dr. Deborah Dysart-Gale Chair Dr. Weichang Du External Examiner Dr. Mourad Debbabi Examiner Dr. Olga Ormandjieva Examiner Dr. Joey Paquet Examiner Dr. Peter Grogono Supervisor Approved by Dr. V. Haarslev, Graduate Program Director Christopher W. Trueman, Dean Faculty of Engineering and Computer Science Abstract Static Analysis of a Concurrent Programming Language by Abstract Interpretation Maryam Zakeryfar, Ph.D. Concordia University, 2014 Static analysis is an approach to determine information about the program without actually executing it. There has been much research in the static analysis of concurrent programs. However, very little academic research has been done on the formal analysis of message passing or process-oriented languages. We currently miss formal analysis tools and tech- niques for concurrent process-oriented languages such as Erasmus .
    [Show full text]
  • Sleeping Barber
    Sleeping Barber CSCI 201 Principles of Software Development Jeffrey Miller, Ph.D. [email protected] Outline • Sleeping Barber USC CSCI 201L Sleeping Barber Overview ▪ The Sleeping Barber problem contains one barber and a number of customers ▪ There are a certain number of waiting seats › If a customer enters and there is a seat available, he will wait › If a customer enters and there is no seat available, he will leave ▪ When the barber isn’t cutting someone’s hair, he sits in his barber chair and sleeps › If the barber is sleeping when a customer enters, he must wake the barber up USC CSCI 201L 3/8 Program ▪ Write a solution to the Sleeping Barber problem. You will need to utilize synchronization and conditions. USC CSCI 201L 4/8 Program Steps – main Method ▪ The SleepingBarber will be the main class, so create the SleepingBarber class with a main method › The main method will instantiate the SleepingBarber › Then create a certain number of Customer threads that arrive at random times • Have the program sleep for a random amount of time between customer arrivals › Have the main method wait to finish executing until all of the Customer threads have finished › Print out that there are no more customers, then wake up the barber if he is sleeping so he can go home for the day USC CSCI 201L 5/8 Program Steps – SleepingBarber ▪ The SleepingBarber constructor will initialize some member variables › Total number of seats in the waiting room › Total number of customers who will be coming into the barber shop › A boolean variable indicating
    [Show full text]
  • Bounded Model Checking for Asynchronous Concurrent Systems
    Bounded Model Checking for Asynchronous Concurrent Systems Manitra Johanesa Rakotoarisoa Department of Computer Architecture Technical University of Catalonia Advisor: Enric Pastor Llorens Thesis submitted to obtain the qualification of Doctor from the Technical University of Catalonia To my mother Contents Abstract xvii Acknowledgments xix 1 Introduction1 1.1 Symbolic Model Checking...........................3 1.1.1 BDD-based approach..........................3 1.1.2 SAT-based Approach..........................6 1.2 Synchronous Versus Asynchronous Systems.................8 1.2.1 Synchronous systems..........................8 1.2.2 Asynchronous systems......................... 10 1.3 Scope of This Work.............................. 11 1.4 Structure of the Thesis............................. 12 2 Background 13 2.1 Transition Systems............................... 13 2.1.1 Definitions............................... 13 2.1.2 Symbolic Representation........................ 15 2.2 Other Models for Concurrent Systems.................... 17 2.2.1 Kripke Structure............................ 17 2.2.2 Petri Nets................................ 21 2.2.3 Automata................................ 22 2.3 Linear Temporal Logic............................. 24 2.4 Satisfiability Problem............................. 26 2.4.1 DPLL Algorithm............................ 27 2.4.2 Stålmarck’s Algorithm......................... 28 2.4.3 Other Methods for Solving SAT................... 32 2.5 Bounded Model Checking........................... 34 2.5.1 BMC Idea...............................
    [Show full text]
  • Using TOST in Teaching Operating Systems and Concurrent Programming Concepts
    Advances in Science, Technology and Engineering Systems Journal Vol. 5, No. 6, 96-107 (2020) ASTESJ www.astesj.com ISSN: 2415-6698 Special Issue on Multidisciplinary Innovation in Engineering Science & Technology Using TOST in Teaching Operating Systems and Concurrent Programming Concepts Tzanko Golemanov*, Emilia Golemanova Department of Computer Systems and Technologies, University of Ruse, Ruse, 7020, Bulgaria A R T I C L E I N F O A B S T R A C T Article history: The paper is aimed as a concise and relatively self-contained description of the educational Received: 30 July, 2020 environment TOST, used in teaching and learning Operating Systems basics such as Accepted: 15 October, 2020 Processes, Multiprogramming, Timesharing, Scheduling strategies, and Memory Online: 08 November, 2020 management. TOST also aids education in some important IT concepts such as Deadlock, Mutual exclusion, and Concurrent processes synchronization. The presented integrated Keywords: environment allows the students to develop and run programs in two simple programming Operating Systems languages, and at the same time, the data in the main system tables can be monitored. The Concurrent Programming paper consists of a description of TOST system, the features of the built-in programming Teaching Tools languages, and demonstrations of teaching the basic Operating Systems principles. In addition, some of the well-known concurrent processing problems are solved to illustrate TOST usage in parallel programming teaching. 1. Introduction • Visual OS simulators This paper is an extension of work originally presented in 29th The systems from the first group (MINIX [2], Nachos [3], Xinu Annual Conference of the European Association for Education in [4], Pintos [5], GeekOS [6]) run on real hardware and are too Electrical and Information Engineering (EAEEIE) [1].
    [Show full text]
  • Concurrency and Synchronization: Semaphores in Action
    CS-350: Fundamentals of Computing Systems Page 1 of 16 Lecture Notes Concurrency and Synchronization: Semaphores in Action In our coverage of semaphore functionality and implementation, we have seen a number of ways that semaphores could come in handy in managing concurrency amongst processes sharing resources or data structures. Broadly speaking, we have seen that semaphores could be used in the following ways: • A binary semaphore initialized to 1 could be used to ensure mutual exclusion, which allows a set of processes to correctly access shared variables such as counters. • A binary semaphore initialized to 0 could be used to force an instruction in one process to wait for the execution of an instruction in another process. This is an example of how semaphores can be used for signaling between processes. • A counting semaphore initialized to K could be used to enforce an upper limit on the number of concurrent uses of a given resource (or service or threads of execution). We will now consider a number of classical problems that are frequently encountered when building computing systems and we will see how semaphores could be used to manage the synchronization issues that arise. The Producer-Consumer Problem In many systems, it is often the case that one process (or more) will be consuming results from one other process (or more). The question is, what sort of synchronization do we need between a (set of) producer(s) and a (set of) consumer(s)? In the following, we will focus on one producer and one consumer, noting that our discussion applies to the general case in which multiple producers and/or consumers exist.
    [Show full text]
  • 5 Classical IPC Problems
    5 Classical IPC Problems 2 The operating systems literature is full of interesting problems that have been widely discussed and analyzed using a variety of synchronization methods. In the following sections we will examine four of the better-known problems. OPERATING SYSTEMS CLASSICAL IPC PROBLEMS 5.1 The Dining Philosophers Problem 5.1 The Dining Philosophers Problem 3 4 Since 1965 (Dijkstra posed and solved this synchronization problem), everyone inventing a new synchronization primitive has tried to demonstrate its abilities by solving the dining philosophers problem. The problem can be stated quite simply as follows. Five philosophers are seated around a circular table. Each philosopher has a plate of spaghetti. The spaghetti is so slippery that a philosopher needs two forks to eat it. Between each pair of plates, there is only one fork. Philosophers eat/think, eating needs 2 forks, pick one fork at a time. How to prevent deadlock? 5.1 The Dining Philosophers Problem 5.1 The Dining Philosophers Problem 5 6 The life of a philosopher consists of alternate periods It has been pointed out that the two-fork requirement of eating and thinking. This is something of an is somewhat artificial; perhaps we should switch from abstraction, even for philosophers, but the other Italian food to Chinese food, replacing rice for activities are irrelevant here. When a philosopher spaghetti and chopsticks for forks. gets hungry, she tries to acquire her left and right forks, one at a time, in either order. If successful in The key question is: Can you write a program for each acquiring two forks, she eats for a while, then puts philosopher that does what it is supposed to do and down the forks, and continues to think.
    [Show full text]
  • Concurrent Programming CLASS NOTES
    COMP 409 Concurrent Programming CLASS NOTES Based on professor Clark Verbrugge's notes Format and figures by Gabriel Lemonde-Labrecque Contents 1 Lecture: January 4th, 2008 7 1.1 Final Exam . .7 1.2 Syllabus . .7 2 Lecture: January 7th, 2008 8 2.1 What is a thread (vs a process)? . .8 2.1.1 Properties of a process . .8 2.1.2 Properties of a thread . .8 2.2 Lifecycle of a process . .9 2.3 Achieving good performances . .9 2.3.1 What is speedup? . .9 2.3.2 What are threads good for then? . 10 2.4 Concurrent Hardware . 10 2.4.1 Basic Uniprocessor . 10 2.4.2 Multiprocessors . 10 3 Lecture: January 9th, 2008 11 3.1 Last Time . 11 3.2 Basic Hardware (continued) . 11 3.2.1 Cache Coherence Issue . 11 3.2.2 On-Chip Multiprocessing (multiprocessors) . 11 3.3 Granularity . 12 3.3.1 Coarse-grained multi-threading (CMT) . 12 3.3.2 Fine-grained multithreading (FMT) . 12 3.4 Simultaneous Multithreading (SMT) . 12 4 Lecture: January 11th, 2008 14 4.1 Last Time . 14 4.2 \replay architecture" . 14 4.3 Atomicity . 15 5 Lecture: January 14th, 2008 16 6 Lecture: January 16th, 2008 16 6.1 Last Time . 16 6.2 At-Most-Once (AMO) . 16 6.3 Race Conditions . 18 7 Lecture: January 18th, 2008 19 7.1 Last Time . 19 7.2 Mutual Exclusion . 19 8 Lecture: January 21st, 2008 21 8.1 Last Time . 21 8.2 Kessel's Algorithm . 22 8.3 Brief Interruption to Introduce Java and PThreads .
    [Show full text]
  • A Structured Programming Approach to Data Ebook
    A STRUCTURED PROGRAMMING APPROACH TO DATA PDF, EPUB, EBOOK Coleman | 222 pages | 27 Aug 2012 | Springer-Verlag New York Inc. | 9781468479874 | English | New York, NY, United States A Structured Programming Approach to Data PDF Book File globbing in Linux. It seems that you're in Germany. De Marco's approach [13] consists of the following objects see figure : [12]. Get print book. Bibliographic information. There is no reason to discard it. No Downloads. Programming is becoming a technology, a theory known as structured programming is developing. Visibility Others can see my Clipboard. From Wikipedia, the free encyclopedia. ALGOL 60 implementation Call stack Concurrency Concurrent programming Cooperating sequential processes Critical section Deadly embrace deadlock Dining philosophers problem Dutch national flag problem Fault-tolerant system Goto-less programming Guarded Command Language Layered structure in software architecture Levels of abstraction Multithreaded programming Mutual exclusion mutex Producer—consumer problem bounded buffer problem Program families Predicate transformer semantics Process synchronization Self-stabilizing distributed system Semaphore programming Separation of concerns Sleeping barber problem Software crisis Structured analysis Structured programming THE multiprogramming system Unbounded nondeterminism Weakest precondition calculus. Comments and Discussions. The code block runs at most once. Latest Articles. Show all. How any system is developed can be determined through a data flow diagram. The result of structured analysis is a set of related graphical diagrams, process descriptions, and data definitions. Therefore, when changes are made to that type of data, the corresponding change must be made at each location that acts on that type of data within the program. It means that the program uses single-entry and single-exit elements.
    [Show full text]
  • A Language-Independent Static Checking System for Coding Conventions
    A Language-Independent Static Checking System for Coding Conventions Sarah Mount A thesis submitted in partial fulfilment of the requirements of the University of Wolverhampton for the degree of Doctor of Philosophy 2013 This work or any part thereof has not previously been presented in any form to the University or to any other body whether for the purposes of as- sessment, publication or for any other purpose (unless otherwise indicated). Save for any express acknowledgements, references and/or bibliographies cited in the work, I confirm that the intellectual content of the work is the result of my own efforts and of no other person. The right of Sarah Mount to be identified as author of this work is asserted in accordance with ss.77 and 78 of the Copyright, Designs and Patents Act 1988. At this date copyright is owned by the author. Signature: . Date: . Abstract Despite decades of research aiming to ameliorate the difficulties of creat- ing software, programming still remains an error-prone task. Much work in Computer Science deals with the problem of specification, or writing the right program, rather than the complementary problem of implementation, or writing the program right. However, many desirable software properties (such as portability) are obtained via adherence to coding standards, and there- fore fall outside the remit of formal specification and automatic verification. Moreover, code inspections and manual detection of standards violations are time consuming. To address these issues, this thesis describes Exstatic, a novel framework for the static detection of coding standards violations. Unlike many other static checkers Exstatic can be used to examine code in a variety of lan- guages, including program code, in-line documentation, markup languages and so on.
    [Show full text]
  • Homework 3 Solutions ECE 426 Spring 2018 Gabriel Kuri
    Homework 3 Solutions ECE 426 Spring 2018 Gabriel Kuri 2 Problems - 50 pts total 1 (25 pts) The sleeping barber problem is a classic process synchronization problem, where a barber shop has one barber, one barber chair, and n chairs for waiting customers, if any, to sit and wait. If there are no customers present, the barber sits down in the barber chair and sleeps. When a customer arrives, he has to wake up the sleeping barber. If additional customers arrive while the barber is cutting a customer's hair, they either sit down (if there are empty chairs) or leave the shop (if all chairs are full). Consider a slight modification to the classic problem, where there are m barbers and m chairs at the barber shop, instead of just one. Write a program in C or pseudocode using semaphores to implement this problem (with m barbers and m barber chairs). 1 semaphore waiting room mutex = 1 ; 2 semaphore barber room mutex = 1 ; 3 semaphore barber c h a i r f r e e = k ; 4 semaphore sleepy b a r b e r s = 0 ; 5 semaphore barber c h a i r s [ k ] = f0 , 0 , 0 , . g ; 6 i n t barber c h a i r s t a t e s [ k ] = f0 , 0 , 0 , . g ; 7 i n t num w a i t i n g c h a i r s f r e e = N; 8 boolean customer entry ( ) f 9 // try to make it into waiting room 10 wait(waiting room mutex ) ; 11 i f (num w a i t i n g c h a i r s f r e e == 0) f 12 signal(waiting room mutex ) ; 13 r e t u r n false; 14 g 15 n u m w a i t i n g c h a i r s f r e e −−;// grabbeda chair 16 signal(waiting room mutex ) ; 17 // now, wait until there isa barber chair free 18 wait(barber c h
    [Show full text]
  • Copyright by Wei-Lun Hung 2016 the Dissertation Committee for Wei-Lun Hung Certifies That This Is the Approved Version of the Following Dissertation
    Copyright by Wei-Lun Hung 2016 The Dissertation Committee for Wei-Lun Hung certifies that this is the approved version of the following dissertation: Asynchronous Automatic-Signal Monitors with Multi-Object Synchronization Committee: Vijay K. Garg, Supervisor Christine Julien Sarfraz Khurshid Neeraj Mittal Dewayne E. Perry Keshav Pingali Asynchronous Automatic-Signal Monitors with Multi-Object Synchronization by Wei-Lun Hung, B.S.E., M.S. DISSERTATION Presented to the Faculty of the Graduate School of The University of Texas at Austin in Partial Fulfillment of the Requirements for the Degree of DOCTOR OF PHILOSOPHY THE UNIVERSITY OF TEXAS AT AUSTIN December 2016 Dedicated to my family. Acknowledgments I would like to express my deep appreciation and thanks to my advisor, Dr. Vijay Garg, for the patient guidance he provided to me. He is a wonderful mentor for me. I would also like to thank my dissertation committee members, Professor Christine Julien, Professor Sarfraz Khurshid, Professor Neeraj Mit- tal, Professor Dewayne E. Perry, and Professor Keshav Pingali for their valu- able suggestions and supports. I would like to thank my labmates, Yen-Jung Chang, Himanshu Chauhan, John Bridgman, and Bharath Balasubramanian, for their advices and help. I also want to thank my friends, Chun-Cheng Chou, Shih-Yen Chen, Chia-Tsen Chen, Tsung-Hsien Lee, Chih-Liang Wang, Jessie Chen, Chao-Yeh Chen, Chia-I Lin, Yi-Hung Wei, Kai-Yang Chiang, Cho-Jui Hsieh, and Si Si for their friendship and all the fun they bring to me during my long journey in finishing this doctoral program. The last word of acknowl- edgment I have saved for my family, my parents, Chi-Fu Hung and Tsai-Lien Tsai, and my younger brother, Wei-Shiang Hung, for their unconditional love.
    [Show full text]
  • Mutual Exclusion UC Santa Barbara
    UC Santa Barbara Operating Systems Christopher Kruegel Department of Computer Science UC Santa Barbara http://www.cs.ucsb.edu/~chris/ Inter-process Communication and Synchronization UC Santa Barbara • Processes/threads may need to exchange information • Processes/threads should not get in each other’s way • Processes/threads should access resources in the right sequence • Need to coordinate the activities of multiple threads • Need to introduce the notion of synchronization operations • These operations allow threads to control the timing of their events relative to events in other threads 2 Asynchrony and Race Conditions UC Santa Barbara • Threads need to deal with asynchrony • Asynchronous events occur arbitrarily during thread execution: – An interrupt causes transfer being taken away from the current thread to the interrupt handler – A timer interrupt causes one thread to be suspended and another one to be resumed – Two threads running on different CPUs read and write the same memory • Threads must be designed so that they can deal with such asynchrony • (If not, the code must be protected from asynchrony) 3 Race Conditions UC Santa Barbara • Two threads, A and B, need to insert objects into a list, so that it can be processed by a third thread, C • Both A and B – Check which is the first available slot in the list – Insert the object in the slot • Everything seems to run fine until... – Thread A finds an available slot but gets suspended by the scheduler – Thread B finds the same slot and inserts its object – Thread B is suspended
    [Show full text]