11/15/2005Comp 120 Fall 20051 15 November Seven Classes to Go! Questions! VM and Making Programs Go.

Slides:



Advertisements
Similar presentations
Slide 2-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 2 Using the Operating System 2.
Advertisements

16 UNIX and Linux. Fig. 16.1: The shell and the kernel.
Processes CSCI 444/544 Operating Systems Fall 2008.
Memory Management Policies: UNIX
MInix memory management1 Minix Memory Management. Contiguous memory management. No swapping. A list of holes sorted in memory address order is maintained.
Introduction to Kernel
Informationsteknologi Friday, November 16, 2007Computer Architecture I - Class 121 Today’s class Operating System Machine Level.
L21 – OS and IO 1 Comp 411– Spring /24/08 Operating System The OS is JUST A PROGRAM but it runs in SUPERVISOR state access to PHYSICAL addresses.
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Process in Unix, Linux and Windows CS-3013 C-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
CS-502 Fall 2006Processes in Unix, Linux, & Windows 1 Processes in Unix, Linux, and Windows CS502 Operating Systems.
Processes and Resources
Process Processes are executing or executable instances of programs. Processes in a modern OS haveOS –management information –resources –unique process.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Operating Systems (CSCI2413) Lecture 3 Processes phones off (please)
Process Description and Control A process is sometimes called a task, it is a program in execution.
Using Two Queues. Using Multiple Queues Suspended Processes Processor is faster than I/O so all processes could be waiting for I/O Processor is faster.
Processes in Unix, Linux, and Windows CS-502 Fall Processes in Unix, Linux, and Windows CS502 Operating Systems (Slides include materials from Operating.
Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access memory.
Process. Process Concept Process – a program in execution Textbook uses the terms job and process almost interchangeably A process includes: – program.
Layers and Views of a Computer System Operating System Services Program creation Program execution Access to I/O devices Controlled access to files System.
Chapter 3.1:Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
1 CS503: Operating Systems Part 1: OS Interface Dongyan Xu Department of Computer Science Purdue University.
System Calls 1.
Process in Unix, Linux, and Windows CS-3013 A-term Processes in Unix, Linux, and Windows CS-3013 Operating Systems (Slides include materials from.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-7 Memory Management (1) Department of Computer Science and Software.
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
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.
Chapter 4 Processes. Process: what is it? A program in execution A program in execution usually usually Can also have suspended or waiting processes Can.
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
OPERATING SYSTEMS Lecture 3: we will explore the role of the operating system in a computer Networks and Communication Department 1.
Multiprogramming. Readings r Silberschatz, Galvin, Gagne, “Operating System Concepts”, 8 th edition: Chapter 3.1, 3.2.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 3: Process-Concept.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto Virtual Memory Implementation.
L20 – OS and IO 1 Comp 411– Fall /09/09 Operating System The OS is JUST A PROGRAM but it runs in SUPERVISOR state access to PHYSICAL addresses access.
Page Replacement Implementation Issues Text: –Tanenbaum ch. 4.7.
Copyright © 2007 by Curt Hill Interrupts How the system responds.
Concepts and Structures. Main difficulties with OS design synchronization ensure a program waiting for an I/O device receives the signal mutual exclusion.
Direct memory access. IO Command includes: buffer address buffer length read or write dada position in disk When IO complete, DMA sends an interrupt request.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Multiprogramming. Readings r Chapter 2.1 of the textbook.
WORKING OF SCHEDULER IN OS
Introduction to Kernel
SLC/VER1.0/OS CONCEPTS/OCT'99
Processes and threads.
Process Management Process Concept Why only the global variables?
Process Realization In OS
Processes in Unix, Linux, and Windows
Operating System The OS is JUST A PROGRAM
Structure of Processes
Operating System The OS is JUST A PROGRAM
Operating Systems Lecture November 2018.
Processes in Unix, Linux, and Windows
CSE 451: Operating Systems Spring 2012 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Process & its States Lecture 5.
Operating Systems.
Process Description and Control
CSCE 313 – Introduction to UNIx process
Process Control B.Ramamurthy 2/22/2019 B.Ramamurthy.
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Processes in Unix, Linux, and Windows
Process Description and Control in Unix
CSE 153 Design of Operating Systems Winter 2019
Process Description and Control in Unix
Clock Algorithm Example
Presentation transcript:

11/15/2005Comp 120 Fall November Seven Classes to Go! Questions! VM and Making Programs Go

11/15/2005Comp 120 Fall Operating System The OS is JUST A PROGRAM –but it runs in SUPERVISOR state access to PHYSICAL addresses access to special registers (like page table register) all IO devices, etc. –whereas ordinary programs run in USER state only access to VIRTUAL addresses through page tables normally no access to IO devices Programs ask the OS for services (syscall) –give me more memory –read/write data from/to disk –put pixel on screen –give me the next character from the keyboard The OS may choose to “map” devices such as the screen into USER space

11/15/2005Comp 120 Fall Shell You normally interact with a SHELL It provides the command prompt, or GUI (graphical user interface) It is JUST A PROGRAM It runs in USER state just like your programs It interprets your mouse clicks or typed commands and asks the OS to implement your requests Suppose you “double-click” on a program icon What happens?

11/15/2005Comp 120 Fall Program Startup in SHELL First the SHELL finds the file (using FILE SYSTEM in OS) indicated by the icon It checks some permissions and such Finally it calls the EXEC system call with the file name and possibly some arguments Now the OS takes over

11/15/2005Comp 120 Fall OS Exec The OS keeps a PROCESS TABLE of all running programs –disk location of executable –memory location of page tables –priority –current status (running, waiting ready, waiting on an event, etc.) –PID (process ID) a number assigned to the process A PROCESS is an independent program running in its own memory space The OS allocates a new entry in the PROCESS TABLE And sets up the PAGE TABLE for the new process

11/15/2005Comp 120 Fall Initial Page Table foo swap 0x text segment 0x text segment 0x data segment 0x x x xffffe000 0xfffff000 1stack memory disk page table

11/15/2005Comp 120 Fall Program Startup Now everything is ready –The PROCESS TABLE entry has been set up –The PAGE TABLE for the process has been initialized –The TEXT SEGMENT is out on disk –The DATA SEGMENT is in memory –The STACK SEGMENT has been allocated 1 PAGE The OS is ready to take the leap of faith ONLY ONE program runs at a time When your program is running the OS is not To run your program and maintain control the OS must trust that is will eventually get control again –when the program asks for a service –when the program does something illegal –when a timer goes off

11/15/2005Comp 120 Fall Fault in the Text When we branch to the beginning of “main” we get a page fault So the OS copies the first page of the TEXT of main to a free page in memory

11/15/2005Comp 120 Fall Fault in the Text foo swap 0x text segment 0x text segment 0x data segment 0x x x xffffe000 0xfffff000 1stack memory disk page table

11/15/2005Comp 120 Fall Allocate a block of memory Now suppose the first thing our program needs to do is get 6k of memory for an array The program uses “new” to make an array Down inside “new” it calls “malloc” Down inside “malloc” it uses a system call to ask the OS for memory The OS will have to find 2 pages to hold 6k

11/15/2005Comp 120 Fall Allocate a block of memory foo swap 0x text segment 0x text segment 0x data segment 0x heap 0x heap 0x xffffe000 0xfffff000 1stack disk page table

11/15/2005Comp 120 Fall Fault in the other page of TEXT foo swap 0x text segment 0x text segment 0x data segment 0x heap 0x heap 0x xffffe000 0xfffff000 1stack memory disk page table

11/15/2005Comp 120 Fall Grow the stack Now our program needs more stack space Perhaps it has to call a recursive function to transverse a complex data structure Or perhaps the user declares an “automatic” array like double work[1000]; which needs 8000 bytes of memory

11/15/2005Comp 120 Fall Grow the stack foo swap 0x text segment 0x text segment 0x data segment 0x heap 0x heap 0x xffffd xffffe xfffff000 1stack memory disk page table

11/15/2005Comp 120 Fall Get partially paged out Sometime later, some other program running on the system needs more memory It asks the OS The OS realizes that not enough physical memory remains available So the OS chooses to PAGE OUT one page from our program It would choose one that hasn’t been used for a while –like possibly one of the heap segments

11/15/2005Comp 120 Fall Partially Paged Out foo swap 0x text segment 0x text segment 0x data segment 0x heap 0x heap 0x xffffd xffffe xfffff000 1stack memory disk page table

11/15/2005Comp 120 Fall Later we need that page foo swap 0x text segment 0x text segment 0x data segment 0x heap 0x heap 0x xffffd xffffe xfffff000 1stack memory disk page table

11/15/2005Comp 120 Fall Exit Finally our program exits It calls the “exit” system call to notify the OS that it is done The OS cleans puts the memory back on the free list Cleans up the PAGE TABLE and PROCESS TABLE And goes on about its business... What does the OS do when no programs are ready?

11/15/2005Comp 120 Fall Classes to go! 6