Wednesday, April 19, 2017

Size: px
Start display at page:

Download "Wednesday, April 19, 2017"

Transcription

1 Wednesday, April 19, 2017 Topics for today Process management (Chapter 8) Loader Traps Interrupts, Time-sharing Storage management (Chapter 9) Main memory (1) Uniprogramming (2) Fixed-partition multiprogramming Process Management (Chapter 8) In Chapter 8 Warford looks at some of the aspects of the Pep/9 operating system (OS). Some aspects of OS operation continue in Chapter 9. We know that the Pep/9 OS handles - loading of user programs into memory - certain "trapped" instructions see Figure 4.6. These have (NOPn), (NOP), (DECI), (DECO), (HEXO) and (STRO). A real operating system will also - handle "interrupts" from external devices such as printers and discs - possibly share resources between multiple concurrent users. These resources would include CPU time, main memory and secondary memory. Loader The Pep/9 loader reads a text file containing hexadecimal numbers terminated with "zz" and stores data in locations 0 onwards in main memory. The code of the loader is short (See Fig. 8.3). It looks like there is error checking done elsewhere and this code does not do any. When run, a user program will always start with the instruction at address 0. In contrast, a real loader reads a file that is likely to Be in some kind of binary format Have multiple sections with individual load-addresses Have an error-checking component Allow user/assembler to specify the program start address Comp 161 Notes Page 1 of 12 April 19, 2017

2 A load file format more general than the one Pep/9 uses might look like the following start address of program when executed number of blocks following (N) block1 - load-address block1 - byte-count block1 - data byte.. block1 - data byte.. blockn - load-address blockn - byte-count blockn - data byte.. blockn - data byte checksum The checksum could be very simple - for example a number so chosen that when all the bytes of the load file are added up (including the checksum) the result mod 256 is zero. In this way the loader can detect some instances of file corruption. At the assembly language level, a typical way for the user to specify the start address of a program is to add a label after.end as in the following a:.word 2 b:.word 99 sub: ldwa... ret loop:... lab:... start: stop.end start So now we don't need to begin a program with "br main" to skip over data regions. Comp 161 Notes Page 2 of 12 April 19, 2017

3 Traps We know that six of the instructions at the assembly language level (NOPn, NOPaaa, DECI, DECO, HEXO and STRO) have no machine language counterpart (compare Fig 5.2 with Fig 4.6). So what happens when program execution reaches an instruction with one of the six special opcodes (001001, 00101, 00110, 00111, 01000, 01001)? What happens is termed a "trap" (or synchronous interrupt). There are three steps in processing a trap 1. Information is saved on the system stack (distinct from the user stack see Figure 4.41) 2. Control is transferred to the operating system where appropriate action is taken. 3. Control is then returned to the user program. Step 1 What information is saved? In general, the data that must be saved is the "Process Control Block" and consists of contents of vital registers and variables. In the case of Pep/9 we save 10 bytes worth of information - see Fig so that the operating system can freely modify registers and status bits without messing up the user program (but see below). For example, if we have ldwa 999,i deci M,d After deci executes we would expect that Register A still contains 999. Step 2 In the last word of the Pep/9 memory is a pointer to the "Trap Handler" (see Fig 4.41). The system follows this pointer and executes the code there. The first thing the code does is to figure out which of the six special instructions was encountered (NOPn, NOPaaa, DECI, DECO, HEXO or STRO) then call an appropriate subroutine using one of two jump tables and CALL with indexing (see code listing in Fig. 8.6). Step 3 At the end of each of the subroutines that processes one of the special instructions, we return to the instruction following the CALL in the trap handler. This instruction is a RETTR (RETurn from TRap) instruction which pops stored data from the system stack then returns control to the user program. Note that one of the three instructions (DECI) may change some of the information saved by the user program (the status bits). For example, in the following we branch depending on the value of N not on the value of M ldwa M,d deci N,d brlt lab ; sets status bits depending on value of M ; sets status bits depending on value of N Comp 161 Notes Page 3 of 12 April 19, 2017

4 The trap instructions (NOPn and NOPaaa) don't do anything. They can be replaced by user-defined instructions. For example, if we wished to implement a multiply instruction we could use one of the two NOP opcodes and add code to the operating system to perform multiplication. (Asynchronous) interrupts Traps are synchronous - you can look at a program and know exactly when they will occur. Interrupts are asynchronous. For example, the program could request a disc transfer then continue processing. When the transfer is complete the disc sends an interrupt signal to the CPU. The time required to complete a disc transfer is variable so we don't know exactly how many instructions will be executed before the interrupt happens. In Pep/9 another difference between traps and interrupts is that traps are not nested 1. While dealing with a trap, a second one cannot occur. In a real system it is possible that while we are dealing with one interrupt (e.g., from a disk) a second one might occur (e.g., from a printer). We can take two possible approaches (a) (b) all interrupts are equally important. When dealing with one we switch off interrupt detection until processing of the current interrupt is finished. some interrupts are more important than others. When dealing with one interrupt we can be interrupted but only if the new one is more important. The CPU uses a few bits in a status register to record its current priority level. Model (b) is typical. Different devices have different priorities (e.g., a printer might have a low priority compared with a network communications card). The priority of the CPU itself is variable and thus the CPU would only be interruptible by some signal more important than the process it is currently running. Imagine how a person performing a low-level task (doing homework?) handles interrupts of varying importance. What importance rating would you assign to the following on a scale of 1 (low) to 10 (high)? Computer announces You ve got mail Phone rings (with voice mail) Text message arrives Doorbell rings Smoke detector goes off Fire alarm goes off in your building We can see the differences between (a) and (b) by considering the following system in which there are three sources of interrupts: Printer (P), Disc (D) and Communication Line (C). For simplicity, assume that each interrupt takes 15 CPU cycles to process. We can determine the start and finish times for the interrupts for each strategy. 1 So the system stack is not really a stack. Comp 161 Notes Page 4 of 12 April 19, 2017

5 (a) Equal priorities Interrupt Time of Request Start Finish P D C P D (b) Priority(P) < Priority(D) < Priority(C) Interrupt Time of Request Start Finish P D C P D Visually (each box represents 5 time units) C1 C1 C1 D1 D1 D1 D2 D2 D2 P1 P1 P1 P2 P2 P P1 D1 C1 P2 D2 Comp 161 Notes Page 5 of 12 April 19, 2017

6 Time-sharing Given the comparatively long time it takes to service an I/O request, it is desirable to have many tasks for the CPU to work on so that when one is held up waiting for an I/O transfer, it can switch to another. In addition, to avoid one program hogging all the CPU time, the OS could allocate CPU time in slices, e.g. 0.1 seconds. Thus, we would need the system clock to be able to send interrupt signals too. The following diagram represents states of a program: Start loaded In queue of runnable program I/O complete selected time-slice exhausted Running normal/ abnormal end Issues I/O request Finished Waitin g for I/O In a time sharing system, a program is unlikely to run to completion in a single burst of CPU time. Thus, the execution of two programs may be interleaved. This could be a problem if they are both updating a common data item. Consider programs A and B Time A: read (X) X = X - 1 write(x) B: read (X) X = X -1 write (X) One of the changes to X is lost. We can define a "critical section" of a program as one which must not be interleaved with the critical section of any other program. There are mechanisms beyond the scope of this course to force the serialization of critical sections. Here is a simple one that assumes each program can access a global variable whose_turn which you can think of as analogous to a police officer directing traffic Program A: while (whose_turn!= A) {} // loop waiting <critical section> whose_turn = B Program B: while (whose_turn!= B) {} // loop waiting <critical section> whose_turn = A Comp 161 Notes Page 6 of 12 April 19, 2017

7 Warford looks at other solutions to the problem but they are beyond the scope of this course. Storage management (Chapter 9) We have seen how an OS can share CPU time among processes. Another resource it has to allocate is main memory which must be apportioned between itself and user programs. The storage management mechanism has to ensure that user programs do not interfere with the OS or with each other. In Section 9.1 Warford considers five increasingly sophisticated memory-sharing techniques: Two problems that must be solved by a memory management mechanism: (a) (b) how to stop a program interfering with other programs (including the O.S.) how to get a program to run correctly given that the assembler does not know where that program will be located in memory at run-time. In addition, we want to make efficient use of memory and CPU time. Here are the 5 techniques (1) Uniprogramming (2) Fixed-partition multiprogramming (3) Variable-partition multiprogramming (4) Paging (5) Virtual memory Each, apart from the first, attempts to solve a problem with the previous technique. Comp 161 Notes Page 7 of 12 April 19, 2017

8 (1) Uniprogramming The memory is divided into User space and Operating System space. User Program Space Operating System Only one user program can run at a time. A fixed set of addresses is available for a user program. The Assembler knows what addresses these are and generates absolute addresses, typically zero upwards. How to protect the operating system? ( In Pep/7, user programs were able to overwrite the operating system. In Pep/9 the operating system locations are write-protected.) For speed, we could use a hardware memory protection scheme. When the system is in user mode (running user program instructions), addresses coming out of the Memory Address Register are checked against the contents of a LIMIT register. If they are greater than the value in the register, an "access violation" interrupt is generated. In Pep/9 the value in the limit register would be FB1616 (see (Figure 4.41) LIMIT MAR comp are Error (Access violation) In general, think of addresses coming out of the program as being intercepted by a Memory Management Unit. The MMU may check and modify the addresses before they are passed to the actual memory. The Operating System is responsible for setting the value in the LIMIT register. When the system is in operating system mode (handling a trap or interrupt for example), error checks are not Comp 161 Notes Page 8 of 12 April 19, 2017

9 performed thus the OS itself can read and write anywhere. If we use SP instead of LIMIT we prevent users from executing code on the stack in a possible buffer-overflow exploit. Disadvantage of Model 1 - there is nothing for the CPU to do when the user program is held up waiting for I/O. (2) Fixed partition multiprogramming. Imagine the user space part of the main memory divided into N partitions P1, P2,... PN. The partitions need not be the same size. P 0 P 1 P 2 P 3 Operating System The operating system has a table showing where each partition begins and ends. In the case of the example above, the table might be something like Partition Base Limit Each partition can hold one user program. Now when one program is held up, e.g. waiting for I/O to complete, the OS may be able to switch to another one in memory that is runnable. Comp 161 Notes Page 9 of 12 April 19, 2017

10 Clearly the assembler does not know which partition a program will be in when it is loaded so how does a program run correctly in any partition? The assembler assumes programs will start at zero thus the addresses in an object program are really relative to the beginning of its partition. We extend the idea from Model 1 of addresses being intercepted by hardware and use a pair of registers: BASE and LIMIT. These are loaded with the appropriate pair of values from the table. So when the program in Partition 2 is running, BASE=30000 and LIMIT= To the address coming out of the MAR (the logical address) we add the contents of the BASE register and check the result of the addition against the LIMIT register. If the result of the addition is an address outside the partition we generate an error otherwise pass the modified address to the memory hardware. BASE LIMIT MAR ADD comp are Error (overflow) Error (Access violation) As the OS switches from one user program to another it loads the BASE and LIMIT registers with the appropriate values. Disadvantage of memory model 2 - the partitions are set ahead of time. The table shown above is fixed in size and the contents are also fixed. What if we want to run a program that is bigger then the biggest partition? Reading In Chapter 8, you can skim the code of the trap handlers for DECI, DECO, HEXO and STRO and skip the more advanced solutions to mutual exclusion described in p. 510 to the end of the chapter. Section 9.1 dealing with the memory models is good. Comp 161 Notes Page 10 of 12 April 19, 2017

11 Review questions 1. What happens if we try to load a program that is too large to fit in memory? 2. Why is the system stack (see, for example, Fig 4.39) mis-named? 3 On a certain system there are three types of device: printers (P), discs (D) and communication cards (C). Servicing an interrupt from any device takes 15 time steps. All devices have the same priority. Fill in the entries in the following table showing when the processing of each of the 5 interrupts begins and ends. Interrupt Priority Time of interrupt P1 Low 21 D1 Medium 26 C1 High 30 P2 Low 42 D2 Medium 70 Start Processing End Processing 4. On a certain system there are three types of device: printers (P) with low priority, discs (D) with medium priority and communication cards (C) with high priority. Servicing an interrupt from any device takes 15 time steps. Assuming that servicing a device can be interrupted by one with a higher priority, fill in the entries in the following table showing when the processing of each of the 5 interrupts begins and ends. Interrupt Priority Time of interrupt P1 Low 21 D1 Medium 26 C1 High 30 P2 Low 42 D2 Medium 70 Start Processing End Processing 5. In model 2, how many user stacks are there? Comp 161 Notes Page 11 of 12 April 19, 2017

12 Review answers 1. If you try to assemble such a program, the assembler detects the error. If you try to load an object file that is too large, no apparent error detection. 2. Only one trap instruction is active at a time so this is just a buffer. 3. Interrupt Priority Time of Start Processing End Processing interrupt P1 Low D1 Medium C1 High P2 Low D2 Medium Interrupt Priority Time of Start Processing End Processing interrupt P1 Low D1 Medium C1 High P2 Low D2 Medium One per partition. Each partition has a complete memory as in Fig 4.39 except smaller and without the operating system part Comp 161 Notes Page 12 of 12 April 19, 2017

Wednesday, April 22, 2015

Wednesday, April 22, 2015 Wednesday, April 22, 2015 Topics for today Topics for Exam 3 Process management (Chapter 8) Loader Traps Interrupts, Time-sharing Storage management (Chapter 9) Main memory (1) Uniprogramming (2) Fixed-partition

More information

Wednesday, November 4, 2009

Wednesday, November 4, 2009 Wednesday, November 4, 2009 Topics for today Storage management Main memory (1) Uniprogramming (2) Fixed-partition multiprogramming (3) Variable-partition multiprogramming (4) Paging (5) Virtual memory

More information

Wednesday, February 7, 2018

Wednesday, February 7, 2018 Wednesday, February 7, 2018 Topics for today The Pep/9 memory Four example programs The loader The assembly language level (Chapter 5) Symbolic Instructions Assembler directives Immediate mode and equate

More information

Wednesday, September 27, 2017

Wednesday, September 27, 2017 Wednesday, September 27, 2017 Topics for today Chapter 6: Mapping High-level to assembly-level The Pep/9 run-time stack (6.1) Stack-relative addressing (,s) SP manipulation Stack as scratch space Global

More information

Wednesday, February 28, 2018

Wednesday, February 28, 2018 Wednesday, February 28, 2018 Topics for today C functions and Pep/9 subroutines Introduction Location of subprograms in a program Translating functions (a) Void functions (b) Void functions with parameters

More information

Wednesday, September 13, Chapter 4

Wednesday, September 13, Chapter 4 Wednesday, September 13, 2017 Topics for today Introduction to Computer Systems Static overview Operation Cycle Introduction to Pep/9 Features of the system Operational cycle Program trace Categories of

More information

Wednesday, February 4, Chapter 4

Wednesday, February 4, Chapter 4 Wednesday, February 4, 2015 Topics for today Introduction to Computer Systems Static overview Operation Cycle Introduction to Pep/8 Features of the system Operational cycle Program trace Categories of

More information

Monday, October 26, 2015

Monday, October 26, 2015 Monday, October 26, 2015 Topics for today Indexed branching Implementation of switch statement Reusable subroutines Indexed branching It turns out that arrays are useful in translating other language constructs,

More information

Wednesday, May 3, Several RAID "levels" have been defined. Some are more commercially viable than others.

Wednesday, May 3, Several RAID levels have been defined. Some are more commercially viable than others. Wednesday, May 3, 2017 Topics for today RAID: Level 0 Level 1 Level 3 Level 4 Level 5 Beyond RAID 5 File systems RAID revisited Several RAID "levels" have been defined. Some are more commercially viable

More information

Monday, March 6, We have seen how to translate void functions. What about functions that return a value such as

Monday, March 6, We have seen how to translate void functions. What about functions that return a value such as Monday, March 6, 2017 Topics for today C functions and Pep/9 subroutines Translating functions (c) Non-void functions (d) Recursive functions Reverse Engineering: Pep/9 to C C Functions and Pep/9 Subroutines

More information

Wednesday, February 15, 2017

Wednesday, February 15, 2017 Wednesday, February 15, 2017 Topics for today Before and after assembly: Macros, Linkers Overview of Chapter 6 Branching Unconditional Status bits and branching If statements While statements The V and

More information

Monday, March 27, 2017

Monday, March 27, 2017 Monday, March 27, 2017 Topics for today Indexed branching Implementation of switch statement Reusable subroutines Indexed branching It turns out that arrays are useful in translating other language constructs,

More information

Memory: Overview. CS439: Principles of Computer Systems February 26, 2018

Memory: Overview. CS439: Principles of Computer Systems February 26, 2018 Memory: Overview CS439: Principles of Computer Systems February 26, 2018 Where We Are In the Course Just finished: Processes & Threads CPU Scheduling Synchronization Next: Memory Management Virtual Memory

More information

Architectural Support for Operating Systems

Architectural Support for Operating Systems OS and Architectures Architectural Support for Operating Systems Emin Gun Sirer What an OS can do is dictated, at least in part, by the architecture. Architecture support can greatly simplify (or complicate)

More information

Embedded Systems Dr. Santanu Chaudhury Department of Electrical Engineering Indian Institute of Technology, Delhi

Embedded Systems Dr. Santanu Chaudhury Department of Electrical Engineering Indian Institute of Technology, Delhi Embedded Systems Dr. Santanu Chaudhury Department of Electrical Engineering Indian Institute of Technology, Delhi Lecture - 13 Virtual memory and memory management unit In the last class, we had discussed

More information

Monday, February 11, 2013

Monday, February 11, 2013 Monday, February 11, 2013 Topics for today The Pep/8 memory Four example programs The loader The assembly language level (Chapter 5) Symbolic Instructions Assembler directives Immediate mode and equate

More information

2 Introduction to Processes

2 Introduction to Processes 2 Introduction to Processes Required readings: Silberschatz/Galvin: Chapter 4 With many things happening at once in a system, need some clean way of separating them all out cleanly. sequential process,

More information

Monday, February 16, 2015

Monday, February 16, 2015 Monday, February 16, 2015 Topics for today How assemblers work Symbol tables ILC Pass 1 algorithm, Error checking Pass 2 Immediate mode and equate Assembler variants: Disassembler, Cross assembler Macros

More information

GUJARAT TECHNOLOGICAL UNIVERSITY MASTER OF COMPUTER APPLICATION SEMESTER: III

GUJARAT TECHNOLOGICAL UNIVERSITY MASTER OF COMPUTER APPLICATION SEMESTER: III GUJARAT TECHNOLOGICAL UNIVERSITY MASTER OF COMPUTER APPLICATION SEMESTER: III Subject Name: Operating System (OS) Subject Code: 630004 Unit-1: Computer System Overview, Operating System Overview, Processes

More information

Q.1 Explain Computer s Basic Elements

Q.1 Explain Computer s Basic Elements Q.1 Explain Computer s Basic Elements Ans. At a top level, a computer consists of processor, memory, and I/O components, with one or more modules of each type. These components are interconnected in some

More information

Administrivia. Deadlock Prevention Techniques. Handling Deadlock. Deadlock Avoidance

Administrivia. Deadlock Prevention Techniques. Handling Deadlock. Deadlock Avoidance Administrivia Project discussion? Last time Wrapped up deadlock Today: Start memory management SUNY-BINGHAMTON CS35 SPRING 8 LEC. #13 1 Handling Deadlock Deadlock Prevention Techniques Prevent hold and

More information

QUIZ. Name all the 4 parts of the fetch-execute cycle.

QUIZ. Name all the 4 parts of the fetch-execute cycle. QUIZ Name all the 4 parts of the fetch-execute cycle. 1 Solution Name all the 4 parts of the fetch-execute cycle. 2 QUIZ Name two fundamental differences between magnetic drives and optical drives: 3 QUIZ

More information

Wednesday, September 20, 2017

Wednesday, September 20, 2017 Wednesday, September 20, 2017 Topics for today More high-level to Pep/9 translations Compilers and Assemblers How assemblers work Symbol tables ILC Pass 1 algorithm, Error checking Pass 2 Immediate mode

More information

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013

CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013 CMSC 313 COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE PROGRAMMING LECTURE 09, SPRING 2013 TOPICS TODAY I/O Architectures Interrupts Exceptions FETCH EXECUTE CYCLE 1.7 The von Neumann Model This is a general

More information

Wednesday, March 12, 2014

Wednesday, March 12, 2014 Wednesday, March 12, 2014 Topics for today Solutions to HW #3 Arrays and Indexed Addressing Global arrays Local arrays Buffer exploit attacks Solutions to Homework #3 1. deci N,d < (a) N not defined lda

More information

Wednesday, March 29, Implementation of sets in an efficient manner illustrates some bit-manipulation ideas.

Wednesday, March 29, Implementation of sets in an efficient manner illustrates some bit-manipulation ideas. Wednesday, March 29, 2017 Topics for today Sets: representation and manipulation using bits Dynamic memory allocation Addressing mode summary Sets Implementation of sets in an efficient manner illustrates

More information

QUIZ. Name all the 4 parts of the fetch-execute cycle.

QUIZ. Name all the 4 parts of the fetch-execute cycle. QUIZ Name all the 4 parts of the fetch-execute cycle. 1 Solution Name all the 4 parts of the fetch-execute cycle. 2 QUIZ Name two fundamental differences between magnetic drives and optical drives: 3 Solution

More information

Wednesday, October 17, 2012

Wednesday, October 17, 2012 Wednesday, October 17, 2012 Topics for today Arrays and Indexed Addressing Arrays as parameters of functions Multi-dimensional arrays Indexed branching Implementation of switch statement Arrays as parameters

More information

Extra-credit QUIZ Pipelining -due next time-

Extra-credit QUIZ Pipelining -due next time- QUIZ Pipelining A computer pipeline has 4 processors, as shown above. Each processor takes 15 ms to execute, and each instruction must go sequentially through all 4 processors. A program has 10 instructions.

More information

n NOPn Unary no operation trap U aaa NOP Nonunary no operation trap i

n NOPn Unary no operation trap U aaa NOP Nonunary no operation trap i Instruction set Instruction Mnemonic Instruction Addressing Status Specifier Mode Bits 0000 0000 STOP Stop execution U 0000 0001 RET Return from CALL U 0000 0010 RETTR Return from trap U 0000 0011 MOVSPA

More information

15 Sharing Main Memory Segmentation and Paging

15 Sharing Main Memory Segmentation and Paging Operating Systems 58 15 Sharing Main Memory Segmentation and Paging Readings for this topic: Anderson/Dahlin Chapter 8 9; Siberschatz/Galvin Chapter 8 9 Simple uniprogramming with a single segment per

More information

16 Sharing Main Memory Segmentation and Paging

16 Sharing Main Memory Segmentation and Paging Operating Systems 64 16 Sharing Main Memory Segmentation and Paging Readings for this topic: Anderson/Dahlin Chapter 8 9; Siberschatz/Galvin Chapter 8 9 Simple uniprogramming with a single segment per

More information

Introduction to Concurrency (Processes, Threads, Interrupts, etc.)

Introduction to Concurrency (Processes, Threads, Interrupts, etc.) Introduction to Concurrency (Processes, Threads, Interrupts, etc.) CS-3013 Operating Systems Hugh C. Lauer (Slides include materials from Slides include materials from Modern Operating Systems, 3 rd ed.,

More information

Last 2 Classes: Introduction to Operating Systems & C++ tutorial. Today: OS and Computer Architecture

Last 2 Classes: Introduction to Operating Systems & C++ tutorial. Today: OS and Computer Architecture Last 2 Classes: Introduction to Operating Systems & C++ tutorial User apps OS Virtual machine interface hardware physical machine interface An operating system is the interface between the user and the

More information

Wednesday, February 19, 2014

Wednesday, February 19, 2014 Wednesda, Februar 19, 2014 Topics for toda Solutions to HW #2 Topics for Eam #1 Chapter 6: Mapping High-level to assembl-level The Pep/8 run-time stack Stack-relative addressing (,s) SP manipulation Stack

More information

Process Description and Control

Process Description and Control Process Description and Control B.Ramamurthy 1/28/02 B.Ramamurthy 1 Introduction The fundamental task of any operating system is process management. OS must allocate resources to processes, enable sharing

More information

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads

Today s Topics. u Thread implementation. l Non-preemptive versus preemptive threads. l Kernel vs. user threads Today s Topics COS 318: Operating Systems Implementing Threads u Thread implementation l Non-preemptive versus preemptive threads l Kernel vs. user threads Jaswinder Pal Singh and a Fabulous Course Staff

More information

Announcement. Exercise #2 will be out today. Due date is next Monday

Announcement. Exercise #2 will be out today. Due date is next Monday Announcement Exercise #2 will be out today Due date is next Monday Major OS Developments 2 Evolution of Operating Systems Generations include: Serial Processing Simple Batch Systems Multiprogrammed Batch

More information

Chapter 13: I/O Systems

Chapter 13: I/O Systems Chapter 13: I/O Systems Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Streams Performance 13.2 Silberschatz, Galvin

More information

Dr. Rafiq Zakaria Campus. Maulana Azad College of Arts, Science & Commerce, Aurangabad. Department of Computer Science. Academic Year

Dr. Rafiq Zakaria Campus. Maulana Azad College of Arts, Science & Commerce, Aurangabad. Department of Computer Science. Academic Year Dr. Rafiq Zakaria Campus Maulana Azad College of Arts, Science & Commerce, Aurangabad Department of Computer Science Academic Year 2015-16 MCQs on Operating System Sem.-II 1.What is operating system? a)

More information

Chapter 1 Computer System Overview

Chapter 1 Computer System Overview Operating Systems: Internals and Design Principles Chapter 1 Computer System Overview Seventh Edition By William Stallings Objectives of Chapter To provide a grand tour of the major computer system components:

More information

Chapter-6. SUBJECT:- Operating System TOPICS:- I/O Management. Created by : - Sanjay Patel

Chapter-6. SUBJECT:- Operating System TOPICS:- I/O Management. Created by : - Sanjay Patel Chapter-6 SUBJECT:- Operating System TOPICS:- I/O Management Created by : - Sanjay Patel Disk Scheduling Algorithm 1) First-In-First-Out (FIFO) 2) Shortest Service Time First (SSTF) 3) SCAN 4) Circular-SCAN

More information

Slide 6-1. Processes. Operating Systems: A Modern Perspective, Chapter 6. Copyright 2004 Pearson Education, Inc.

Slide 6-1. Processes. Operating Systems: A Modern Perspective, Chapter 6. Copyright 2004 Pearson Education, Inc. Slide 6-1 6 es Announcements Slide 6-2 Extension til Friday 11 am for HW #1 Previous lectures online Program Assignment #1 online later today, due 2 weeks from today Homework Set #2 online later today,

More information

Chapter 13: I/O Systems

Chapter 13: I/O Systems Chapter 13: I/O Systems Chapter 13: I/O Systems I/O Hardware Application I/O Interface Kernel I/O Subsystem Transforming I/O Requests to Hardware Operations Streams Performance 13.2 Silberschatz, Galvin

More information

Monday, September 28, 2015

Monday, September 28, 2015 Monda, September 28, 2015 Topics for toda Chapter 6: Mapping High-level to assembl-level The Pep/8 run-time stack (6.1) Stack-relative addressing (,s) SP manipulation Stack as scratch space Global variables

More information

Yielding, General Switching. November Winter Term 2008/2009 Gerd Liefländer Universität Karlsruhe (TH), System Architecture Group

Yielding, General Switching. November Winter Term 2008/2009 Gerd Liefländer Universität Karlsruhe (TH), System Architecture Group System Architecture 6 Switching Yielding, General Switching November 10 2008 Winter Term 2008/2009 Gerd Liefländer 1 Agenda Review & Motivation Switching Mechanisms Cooperative PULT Scheduling + Switch

More information

Main Points of the Computer Organization and System Software Module

Main Points of the Computer Organization and System Software Module Main Points of the Computer Organization and System Software Module You can find below the topics we have covered during the COSS module. Reading the relevant parts of the textbooks is essential for a

More information

Classifying Information Stored in Memory! Memory Management in a Uniprogrammed System! Segments of a Process! Processing a User Program!

Classifying Information Stored in Memory! Memory Management in a Uniprogrammed System! Segments of a Process! Processing a User Program! Memory Management in a Uniprogrammed System! A! gets a fixed segment of (usually highest )"! One process executes at a time in a single segment"! Process is always loaded at "! Compiler and linker generate

More information

What is an Operating System? A Whirlwind Tour of Operating Systems. How did OS evolve? How did OS evolve?

What is an Operating System? A Whirlwind Tour of Operating Systems. How did OS evolve? How did OS evolve? What is an Operating System? A Whirlwind Tour of Operating Systems Trusted software interposed between the hardware and application/utilities to improve efficiency and usability Most computing systems

More information

Unit 2 : Computer and Operating System Structure

Unit 2 : Computer and Operating System Structure Unit 2 : Computer and Operating System Structure Lesson 1 : Interrupts and I/O Structure 1.1. Learning Objectives On completion of this lesson you will know : what interrupt is the causes of occurring

More information

Monday, March 13, 2017

Monday, March 13, 2017 Monday, March 13, 2017 Topics for today Arrays and Indexed Addressing Global arrays Local arrays Buffer exploit attacks Arrays and indexed addressing (section 6.4) So far we have looked at scalars (int,

More information

Operating Systems. Memory Management. Lecture 9 Michael O Boyle

Operating Systems. Memory Management. Lecture 9 Michael O Boyle Operating Systems Memory Management Lecture 9 Michael O Boyle 1 Memory Management Background Logical/Virtual Address Space vs Physical Address Space Swapping Contiguous Memory Allocation Segmentation Goals

More information

Lecture V Toy Hardware and Operating System

Lecture V Toy Hardware and Operating System 2. THE Machine Lecture V Page 1 Lecture V Toy Hardware and Operating System 1. Introduction For use in our OS projects, we introduce THE Machine where THE is an acronym 1 for Toy HardwarE. We also introduce

More information

Main Memory (Part I)

Main Memory (Part I) Main Memory (Part I) Amir H. Payberah amir@sics.se Amirkabir University of Technology (Tehran Polytechnic) Amir H. Payberah (Tehran Polytechnic) Main Memory 1393/8/5 1 / 47 Motivation and Background Amir

More information

Low-level software. Components Circuits Gates Transistors

Low-level software. Components Circuits Gates Transistors QUIZ Pipelining A computer pipeline has 4 processors, as shown above. Each processor takes 15 ms to execute, and each instruction must go sequentially through all 4 processors. A program has 10 instructions.

More information

Wednesday, November 22, 2017

Wednesday, November 22, 2017 Wednesday, November 22, 2017 Topics for today Storage management (Chapter 9) Main memory (3) Variable-partition multiprogramming (4) Paging (5) Virtual memory Page turning algorithms Summary of 5 memory

More information

HY345 - Operating Systems

HY345 - Operating Systems HY345 - Operating Systems Recitation 1 - Process Management and Synchronization Solutions Dimitris Deyannis deyannis@csd.uoc.gr Problem 3 On all current computers, at least part of the interrupt handlers

More information

OPERATING SYSTEMS CS136

OPERATING SYSTEMS CS136 OPERATING SYSTEMS CS136 Jialiang LU Jialiang.lu@sjtu.edu.cn Based on Lecture Notes of Tanenbaum, Modern Operating Systems 3 e, 1 Chapter 5 INPUT/OUTPUT 2 Overview o OS controls I/O devices => o Issue commands,

More information

Wednesday, September 21, 2016

Wednesday, September 21, 2016 Wednesday, September 21, 2016 Topics for today More high-level to translations Compilers and Assemblers How assemblers work Symbol tables ILC Pass 1 algorithm, Error checking Pass 2 Immediate mode and

More information

What s An OS? Cyclic Executive. Interrupts. Advantages Simple implementation Low overhead Very predictable

What s An OS? Cyclic Executive. Interrupts. Advantages Simple implementation Low overhead Very predictable What s An OS? Provides environment for executing programs Process abstraction for multitasking/concurrency scheduling Hardware abstraction layer (device drivers) File systems Communication Do we need an

More information

The control of I/O devices is a major concern for OS designers

The control of I/O devices is a major concern for OS designers Lecture Overview I/O devices I/O hardware Interrupts Direct memory access Device dimensions Device drivers Kernel I/O subsystem Operating Systems - June 26, 2001 I/O Device Issues The control of I/O devices

More information

Input/Output Management

Input/Output Management Chapter 11 Input/Output Management This could be the messiest aspect of an operating system. There are just too much stuff involved, it is difficult to develop a uniform and consistent theory to cover

More information

CS 537 Lecture 2 Computer Architecture and Operating Systems. OS Tasks

CS 537 Lecture 2 Computer Architecture and Operating Systems. OS Tasks CS 537 Lecture 2 Computer Architecture and Operating Systems Michael Swift OS Tasks What is the role of the OS regarding hardware? What does the OS need from hardware to perform this role? 1 Computer Hardware

More information

Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering)

Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering) A. Multiple Choice Questions (60 questions) Subject: Operating System (BTCOC403) Class: S.Y.B.Tech. (Computer Engineering) Unit-I 1. What is operating system? a) collection of programs that manages hardware

More information

Memory Management. Kevin Webb Swarthmore College February 27, 2018

Memory Management. Kevin Webb Swarthmore College February 27, 2018 Memory Management Kevin Webb Swarthmore College February 27, 2018 Today s Goals Shifting topics: different process resource memory Motivate virtual memory, including what it might look like without it

More information

Chapter 7: Main Memory. Operating System Concepts Essentials 8 th Edition

Chapter 7: Main Memory. Operating System Concepts Essentials 8 th Edition Chapter 7: Main Memory Operating System Concepts Essentials 8 th Edition Silberschatz, Galvin and Gagne 2011 Chapter 7: Memory Management Background Swapping Contiguous Memory Allocation Paging Structure

More information

EC2304-MICROPROCESSOR AND MICROCONROLLERS 2 marks questions and answers UNIT-I

EC2304-MICROPROCESSOR AND MICROCONROLLERS 2 marks questions and answers UNIT-I EC2304-MICROPROCESSOR AND MICROCONROLLERS 2 marks questions and answers 1. Define microprocessors? UNIT-I A semiconductor device(integrated circuit) manufactured by using the LSI technique. It includes

More information

Chapter 8: Memory Management. Operating System Concepts with Java 8 th Edition

Chapter 8: Memory Management. Operating System Concepts with Java 8 th Edition Chapter 8: Memory Management 8.1 Silberschatz, Galvin and Gagne 2009 Background Program must be brought (from disk) into memory and placed within a process for it to be run Main memory and registers are

More information

CSC 453 Operating Systems

CSC 453 Operating Systems CSC 453 Operating Systems Lecture 3: Operating-System Structures Operating System Components Operating systems are large and complex - the only way to manage such a project is to divide it into smaller

More information

CS307: Operating Systems

CS307: Operating Systems CS307: Operating Systems Chentao Wu 吴晨涛 Associate Professor Dept. of Computer Science and Engineering Shanghai Jiao Tong University SEIEE Building 3-513 wuct@cs.sjtu.edu.cn Download Lectures ftp://public.sjtu.edu.cn

More information

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006 Operating Systems Comprehensive Exam Spring 2006 Student ID # 3/16/2006 You must complete all of part I (60%) You must complete two of the three sections in part II (20% each) In Part I, circle or select

More information

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION

B.H.GARDI COLLEGE OF MASTER OF COMPUTER APPLICATION Introduction :- An exploits the hardware resources of one or more processors to provide a set of services to system users. The OS also manages secondary memory and I/O devices on behalf of its users. So

More information

Memory Allocation. Copyright : University of Illinois CS 241 Staff 1

Memory Allocation. Copyright : University of Illinois CS 241 Staff 1 Memory Allocation Copyright : University of Illinois CS 241 Staff 1 Allocation of Page Frames Scenario Several physical pages allocated to processes A, B, and C. Process B page faults. Which page should

More information

Process Description and Control

Process Description and Control Process Description and Control 1 Process:the concept Process = a program in execution Example processes: OS kernel OS shell Program executing after compilation www-browser Process management by OS : Allocate

More information

Hardware OS & OS- Application interface

Hardware OS & OS- Application interface CS 4410 Operating Systems Hardware OS & OS- Application interface Summer 2013 Cornell University 1 Today How my device becomes useful for the user? HW-OS interface Device controller Device driver Interrupts

More information

CS 153 Design of Operating Systems Winter 2016

CS 153 Design of Operating Systems Winter 2016 CS 153 Design of Operating Systems Winter 2016 Lecture 17: Paging Lecture Overview Recap: Today: Goal of virtual memory management: map 2^32 byte address space to physical memory Internal fragmentation

More information

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski Operating Systems Design Fall 2010 Exam 1 Review Paul Krzyzanowski pxk@cs.rutgers.edu 1 Question 1 To a programmer, a system call looks just like a function call. Explain the difference in the underlying

More information

Operating Systems. Operating System Structure. Lecture 2 Michael O Boyle

Operating Systems. Operating System Structure. Lecture 2 Michael O Boyle Operating Systems Operating System Structure Lecture 2 Michael O Boyle 1 Overview Architecture impact User operating interaction User vs kernel Syscall Operating System structure Layers Examples 2 Lower-level

More information

What Operating Systems Do An operating system is a program hardware that manages the computer provides a basis for application programs acts as an int

What Operating Systems Do An operating system is a program hardware that manages the computer provides a basis for application programs acts as an int Operating Systems Lecture 1 Introduction Agenda: What Operating Systems Do Computer System Components How to view the Operating System Computer-System Operation Interrupt Operation I/O Structure DMA Structure

More information

University of Waterloo Midterm Examination Model Solution CS350 Operating Systems

University of Waterloo Midterm Examination Model Solution CS350 Operating Systems University of Waterloo Midterm Examination Model Solution CS350 Operating Systems Fall, 2003 1. (10 total marks) Suppose that two processes, a and b, are running in a uniprocessor system. a has three threads.

More information

Bits and Bytes. Here is a sort of glossary of computer buzzwords you will encounter in computer use:

Bits and Bytes. Here is a sort of glossary of computer buzzwords you will encounter in computer use: Bits and Bytes Here is a sort of glossary of computer buzzwords you will encounter in computer use: Bit Computer processors can only tell if a wire is on or off. Luckily, they can look at lots of wires

More information

Operating Systems Overview

Operating Systems Overview Operating Systems Overview 1 operating system no clear traditional definition each definition cover a distinct aspect an interface between applications and hardware true, this was the first reason for

More information

Real-Time Programming

Real-Time Programming Real-Time Programming Week 7: Real-Time Operating Systems Instructors Tony Montiel & Ken Arnold rtp@hte.com 4/1/2003 Co Montiel 1 Objectives o Introduction to RTOS o Event Driven Systems o Synchronization

More information

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Disks. Protection & Security

Input/Output. Today. Next. Principles of I/O hardware & software I/O software layers Disks. Protection & Security Input/Output Today Principles of I/O hardware & software I/O software layers Disks Next Protection & Security Operating Systems and I/O Two key operating system goals Control I/O devices Provide a simple,

More information

Input Output (IO) Management

Input Output (IO) Management Input Output (IO) Management Prof. P.C.P. Bhatt P.C.P Bhatt OS/M5/V1/2004 1 Introduction Humans interact with machines by providing information through IO devices. Manyon-line services are availed through

More information

CSE 153 Design of Operating Systems

CSE 153 Design of Operating Systems CSE 153 Design of Operating Systems Winter 19 Lecture 3: OS model and Architectural Support Last time/today Historic evolution of Operating Systems (and computing!) Today: We start our journey in exploring

More information

Dr. D. M. Akbar Hussain DE5 Department of Electronic Systems

Dr. D. M. Akbar Hussain DE5 Department of Electronic Systems Process /Task 1 Process Management Creation & termination of processes (user + System) Interleaving the execution of processes Scheduling of processes Synchronization mechanism between processes Communication

More information

Computer Architecture Prof. Mainak Chaudhuri Department of Computer Science & Engineering Indian Institute of Technology, Kanpur

Computer Architecture Prof. Mainak Chaudhuri Department of Computer Science & Engineering Indian Institute of Technology, Kanpur Computer Architecture Prof. Mainak Chaudhuri Department of Computer Science & Engineering Indian Institute of Technology, Kanpur Lecture - 7 Case study with MIPS-I So, we were discussing (Refer Time: 00:20),

More information

Subroutines and the Stack

Subroutines and the Stack 3 31 Objectives: A subroutine is a reusable program module A main program can call or jump to the subroutine one or more times The stack is used in several ways when subroutines are called In this lab

More information

David DeFlyer Class notes CS162 January 26 th, 2009

David DeFlyer Class notes CS162 January 26 th, 2009 1. Class opening: 1. Handed out ACM membership information 2. Review of last lecture: 1. operating systems were something of an ad hoc component 2. in the 1960s IBM tried to produce a OS for all customers

More information

When an instruction is initially read from memory it goes to the Instruction register.

When an instruction is initially read from memory it goes to the Instruction register. CS 320 Ch. 12 Instruction Sets Computer instructions are written in mnemonics. Mnemonics typically have a 1 to 1 correspondence between a mnemonic and the machine code. Mnemonics are the assembly language

More information

Memory Management. CSCI 315 Operating Systems Design Department of Computer Science

Memory Management. CSCI 315 Operating Systems Design Department of Computer Science Memory Management CSCI 315 Operating Systems Design Department of Computer Science Notice: The slides for this lecture are based on those from Operating Systems Concepts, 9th ed., by Silberschatz, Galvin,

More information

Chapter 4. MARIE: An Introduction to a Simple Computer. Chapter 4 Objectives. 4.1 Introduction. 4.2 CPU Basics

Chapter 4. MARIE: An Introduction to a Simple Computer. Chapter 4 Objectives. 4.1 Introduction. 4.2 CPU Basics Chapter 4 Objectives Learn the components common to every modern computer system. Chapter 4 MARIE: An Introduction to a Simple Computer Be able to explain how each component contributes to program execution.

More information

Chapter 8: Main Memory

Chapter 8: Main Memory Chapter 8: Main Memory Chapter 8: Memory Management Background Swapping Contiguous Memory Allocation Segmentation Paging Structure of the Page Table Example: The Intel 32 and 64-bit Architectures Example:

More information

Architecture and OS. To do. q Architecture impact on OS q OS impact on architecture q Next time: OS components and structure

Architecture and OS. To do. q Architecture impact on OS q OS impact on architecture q Next time: OS components and structure Architecture and OS To do q Architecture impact on OS q OS impact on architecture q Next time: OS components and structure Computer architecture and OS OS is intimately tied to the hardware it runs on

More information

Process Description and Control. Chapter 3

Process Description and Control. Chapter 3 Process Description and Control Chapter 3 Contents Process states Process description Process control Unix process management Process From processor s point of view execute instruction dictated by program

More information

Memory Management II

Memory Management II Memory Management II an OS view Dr Alun Moon Computing, Engineering and Information Sciences 1st November 2011 Dr Alun Moon (ceis:nu) Memory Management II 1st November 2011 1 / 16 Processes in memory Memory

More information

Operating Systems Unit 6. Memory Management

Operating Systems Unit 6. Memory Management Unit 6 Memory Management Structure 6.1 Introduction Objectives 6.2 Logical versus Physical Address Space 6.3 Swapping 6.4 Contiguous Allocation Single partition Allocation Multiple Partition Allocation

More information

CSE306 - Homework2 and Solutions

CSE306 - Homework2 and Solutions CSE306 - Homework2 and Solutions Note: your solutions must contain enough information to enable the instructor to judge whether you understand the material or not. Simple yes/no answers do not count. A

More information

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst Operating Systems CMPSCI 377 Spring 2017 Mark Corner University of Massachusetts Amherst Last Class: Intro to OS An operating system is the interface between the user and the architecture. User-level Applications

More information