The Operating System Machine Level Chapter 6. Operating System Machine Positioning of the operating system machine level.

Slides:



Advertisements
Similar presentations
Operating System Structures
Advertisements

Part IV: Memory Management
Operating Systems Review.
Slide 2-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 2 Using the Operating System 2.
Memory Management Paging &Segmentation CS311, CS350 & CS550.
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 3 Memory Management Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Chorus and other Microkernels Presented by: Jonathan Tanner and Brian Doyle Articles By: Jon Udell Peter D. Varhol Dick Pountain.
Chap 2 System Structures.
CSC 322 Operating Systems Concepts Lecture - 18: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
File Management Systems
Memory Management (II)
Operating System Support Focus on Architecture
Virtual Memory Chapter 8. Hardware and Control Structures Memory references are dynamically translated into physical addresses at run time –A process.
Lecture 11: Memory Management
1 Case Study 2: Windows 2000 Chapter History of windows Programming windows System structure 11.4 Processes and threads in.
1 Pertemuan 16 Isu-Isu pada Sistem Paging dan Segmentasi Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5.
Memory Management 2010.
Informationsteknologi Friday, November 16, 2007Computer Architecture I - Class 121 Today’s class Operating System Machine Level.
CMPT 300: Final Review Chapters 8 – Memory Management: Ch. 8, 9 Address spaces Logical (virtual): generated by the CPU Physical: seen by the memory.
Chapter 3.2 : Virtual Memory
Memory Management 1 CS502 Spring 2006 Memory Management CS-502 Spring 2006.
CS-3013 & CS-502, Summer 2006 Memory Management1 CS-3013 & CS-502 Summer 2006.
Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved The Operating System Machine.
Computer Organization and Architecture
OPERATING SYSTEMS Introduction
Chapter 3 Memory Management 3.7 Segmentation. A compiler has many tables that are built up as compilation proceeds, possibly including: The source text.
Basics of Operating Systems March 4, 2001 Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard.
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
Ceng Operating Systems 11-1 Chapter 11 : Case Study - Win 2000 History of windows 2000 Programming windows 2000 System structure Processes and threads.
Chapter 8 Windows Outline Programming Windows 2000 System structure Processes and threads in Windows 2000 Memory management The Windows 2000 file.
Chapter 3 Memory Management: Virtual Memory
MODERN OPERATING SYSTEMS Third Edition ANDREW S. TANENBAUM Chapter 11 Case Study 2: Windows Vista Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Rensselaer Polytechnic Institute CSC 432 – Operating Systems David Goldschmidt, Ph.D.
Tanenbaum & Woodhull, Operating Systems: Design and Implementation, (c) 2006 Prentice-Hall, Inc. All rights reserved OPERATING SYSTEMS DESIGN.
Cosc 3P92 Week 9 & 10 Lecture slides
Segmentation & O/S Input/Output Chapter 4 & 5 Tuesday, April 3, 2007.
Threads, Thread management & Resource Management.
Memory Management 3 Tanenbaum Ch. 3 Silberschatz Ch. 8,9.
1 Chapter 3.2 : Virtual Memory What is virtual memory? What is virtual memory? Virtual memory management schemes Virtual memory management schemes Paging.
CIS250 OPERATING SYSTEMS Memory Management Since we share memory, we need to manage it Memory manager only sees the address A program counter value indicates.
Windows 2000 Course Summary Computing Department, Lancaster University, UK.
1 Memory Management 4.1 Basic memory management 4.2 Swapping 4.3 Virtual memory 4.4 Page replacement algorithms 4.5 Modeling page replacement algorithms.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3.
File Management Chapter 12. File Management File management system is considered part of the operating system Input to applications is by means of a file.
30 October Agenda for Today Introduction and purpose of the course Introduction and purpose of the course Organization of a computer system Organization.
Chapter 4 Memory Management Segmentation. (a) One address space. (b) Separate I and D spaces. Separate Instruction and Data Spaces.
UNIX & Windows NT Name: Jing Bai ID: Date:8/28/00.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
操作系统原理 OPERATING SYSTEM Chapter 3 Memory Management 内存管理.
Page Replacement Implementation Issues Text: –Tanenbaum ch. 4.7.
Chapter 1 Introduction  What is an operating system  History of operating systems  The operating system zoo  Computer hardware review  Operating system.
Major OS Components CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
ECE 456 Computer Architecture Lecture #9 – Input/Output Instructor: Dr. Honggang Wang Fall 2013.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
Memory Management Chapter 3
CE 454 Computer Architecture
Memory Management Paging (continued) Segmentation
Chapter 3: Process Concept
Chapter 11: File System Implementation
Session 3 Memory Management
Section 10: Last section! Final review.
Memory Management Paging (continued) Segmentation
The Operating System Machine Level
Virtual Memory Overcoming main memory size limitation
Operating Systems Lecture 1.
Memory Management Paging (continued) Segmentation
CSE 542: Operating Systems
Presentation transcript:

The Operating System Machine Level Chapter 6

Operating System Machine Positioning of the operating system machine level.

overview a)OSM (Operating System Machine) is always interpreted b)OSM is optional c)ISA is sometimes interpreted d)ISA can run without OSM. OSM can not run without ISA. e)OSM adds system calls f)3 Main areas for this chapter –virtual memory –file I/O –parallel processing

Segmentation a)Program assigned memory of base plus largest overlay b)Segmentation is defined by program/compiler c)Efficiency was controlled by programmer/compiler d)Virtual memory dynamic –Programmer does not need to be involved –Machine can learn efficiency –Requires OSM

Paging A mapping in which virtual addresses 4096 to 8191 are mapped onto main memory addresses 0 to 4095.

Virtual Memory a)Steps for virtual memory –save main memory if required –find data on disk –load data from disk –change address map –continue- program does not know it was interrupted –How would this impact caching? virtual address space vs. physical address space

Implementation of Paging (1) The first 64 KB of virtual address space divided into 16 pages, with each page being 4K.

Implementation of Paging (2) A 32 KB main memory divided up into eight page frames of 4 KB each.

Implementation of Paging (3) Formation of a main memory address from a virtual address.

Demand Paging and the Working Set Model A possible mapping of the first 16 virtual pages onto a main memory with eight page frames.

virtual memory a)demanding paging as needed pages loaded into memory b)page fault – trying to access memory not in memory c)working set – pages necessary for the last k memlry references d)Page Replacement –LRU – least recently used –FIFO Thrashing

Page Replacement Policy Failure of the LRU algorithm.

Segmentation (1) In a one-dimensional address space with growing tables, one table may bump into another.

Segmentation (2) A segmented memory allows each table to grow or shrink independently of the other tables.

Segmentation (3) Comparison of paging and segmentation.

Implementation of Segmentation (1) (a)-(d) Development of external fragmentation. (e) Removal of the external fragmentation by compaction.

Implementation of Segmentation (2) Conversion of a two-part MULTICS address into a main memory address.

Virtual Memory on the Pentium 4 (1) A Pentium 4 selector. A Pentium 4 code segment descriptor. Data segments differ slightly.

Virtual Memory on the Pentium 4 (2) Conversion of a (selector, offset) pair to a linear address.

Virtual Memory on the Pentium 4 (3) Mapping of a linear address onto a physical address.

Virtual Memory on the Pentium 4 (4) Protection on the Pentium 4.

Virtual Memory on the UltraSPARC III (1) Virtual to physical mappings on the UltraSPARC.

Virtual Memory on the UltraSPARC III (2) Data structures used in translating virtual addresses on the UltraSPARC. (a) TLB. (b) TSB. (c) Translation table.

Files a)A disk is a collection of sectors with only a lineal relationship to each other. b)A file is s abstraction created by a programmer c)A record is a abstraction created by a programmer d)A database is a abstraction created by a programmer e)Conventions are enforced by software f)I/O is performed by setting bits and bytes/words in device registers. g)Error correction shared between hardware and OSM h)Device properties will control some functions of how the OSM used the device

Implementation of Virtual I/O Instructions (1) Reading a file consisting of logical records. (a) Before reading record 19. (b) After reading record 19.

Files a)Pointers (current record) or EOF are maintained by OSM b)Allocation units and sectors on a disk may be different c)Programs see records which are different than allocation units or sectors d)Allocation units may or may not be consecutive (CD-ROM vs. disk) e)a logical file may consist of more than one OSM file. f)File organization is all OSM g)Free space is tracked by OSM bit map vs. free list h)Processing efficiency argues for large allocation blocks however space utilization argues for small blocks

Implementation of Virtual I/O Instructions (2) Disk allocation strategies. (a) A file in consecutive sectors. (b) A file not in consecutive sectors.

Implementation of Virtual I/O Instructions (3) Two ways of keeping track of available sectors. (a) A free list. (b) A bit map.

Directory Management Instructions A user file directory and the contents of a typical entry in a file directory.

Directories a)OSM functions for disk –Create file –Delete file –Rename file –Change protection status of file –Secure file –Encrypt file –Read file –Write file –Create directories –Delete directories –identify directories –allow embedded directories

Parallel processing a)Programs and libraries are OSM abstractions b)Reasons for parallel processing –Limitations of light speed –1 nanosecond = 1 ft –Cooperating processors can speed calculations over one processor –requires multiple CPU’s –simulate with each process have a small time slot

Process creation a)program runs as part of a process b)process has state and address space c)system call creates process d)parents may or may not have control of process they start e)Race condition –consumer –producer –circular buffer –sleep/resume –see program listing pg 464 –fatal flaw

Virtual Instructions for Parallel Processing (a) True parallel processing with multiple CPUs. (b) Parallel processing simulated by switching one CPU among three processes.

Race Conditions (1) Use of a circular buffer.

Race Conditions (2) Parallel processing with a fatal race condition.

Race Conditions (3) Parallel processing with a fatal race condition.

Race Conditions (4) Parallel processing with a fatal race condition.

Race Conditions (5) Failure of the producer-consumer communication mechanism.

Process Synchronization Using Semaphores (1) The effect of a semaphore operation.

Process Synchronization Using Semaphores (2) Parallel processing using semaphores.

Process Synchronization Using Semaphores (3) Parallel processing using semaphores.

Process Synchronization Using Semaphores (4) Parallel processing using semaphores.

Unix a)UNIX – written in C b)Berkley added paged virtual memory, long file names and TCP/IP c)ATT came up with System III and then System V incompatible with Berkley UNIX d)POSIX – standard for basic UNIX system e)MINIX lead to Linux f)All may have calls that go beyond standard g)Caused by MSDOS being backward compatiable and running code on any version h)Berkley was responsible for networking (sockets)

MINIX a)

UNIX (1) A rough breakdown of the UNIX system calls.

UNIX (2) The structure of a typical UNIX system.

Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved Streams a)Originally each device driver was responsible for all functions b)Streams allows modules to be shared by device drivers for flow control

Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved Windows XP a)MS-DOS 1.0 was 8 k single user command line OS b)MS-DOS 2.0 and 3.0 etc. add new features but kept command line format c)Windows thru 3.x were front ends to DOS d)Windows 95 (1995) still used DOS file system except for long names and increased number of blocks on disk e)Windows 98 had improvements leading to DOJ law suit f)Windows ME – slightly improved(?) g)Windows NT complete rewrite h)Windows 2000 – upgrade of NT i)Windows XP – upgrade of 2000

Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved Windows XP a)XP has server and client versions b)XP– 32 bit operating system with each user having their own 32-bit demand page virtual address c).

Windows XP The structure of Windows XP.

UNIX Virtual Memory The address space of a single UNIX process.

Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved UNIX virtual memory a)Berkley demand page virtual memory one address space b)System V and Solaris include map file or portion of into memory

Windows XP Virtual Memory The principal Windows XP API calls for managing virtual memory.

Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved XP Virtual Memory a)Every user process has it’s own virtual address space b)2 GB for application and 2 GB for Kernel c)demand page with 4 KB page size d)3 states free, reserved or committed –free – not in use –auto pagefault –committed code or data mapped to it –reserved – not available for mapping Allows for memory mapped files

UNIX Virtual I/O (1) The principal UNIX file system calls.

UNIX Virtual I/O (2) A program fragment for copying a file using the UNIX system calls. This fragment is in C because Java hides the low-level system calls and we are trying to expose them.

UNIX Virtual I/O (3) Part of a typical UNIX directory system.

Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved UNIX IO a)root directory is where directories start b)subdirectories are under root c)Special directories include bin, dev, lib and usr d)Standard files o= Standard Input, 1 = Standard output and 2 = Standard Error e)path starting a root is absolute path f)link path to an existing file g)inode contains file information including type, protection, lick count, owner, length, owner group, disk address es

UNIX Virtual I/O (4) The principal UNIX directory management calls.

Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved XP Virtual IO a)Supports FAT and NTFS b)Uses ACL and SID for security c)MFT – master file table

Windows XP Virtual I/O (1) The principal Win32 API functions for file I/O. The second column gives the nearest UNIX equivalent.

Windows XP Virtual I/O (2) A program fragment for copying a file using the Windows XP API functions. This fragment is in C because Java hides the low-level system calls and we are trying to expose them.

Windows XP Virtual I/O (3) The principal Win32 API functions for directory management. The second column gives the nearest UNIX equivalent, when one exists.

Windows XP Virtual I/O (4) The Windows XP master file table.

UNIX Process Management (1) A process tree in UNIX.

Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved UNIX Process a)parent/child via fork b)one of the fork can then exec a program c)Parent can continue or wait d)processes communicate via pipes e)Some UNIX systems use message queues f)Threads are also allowed. Threads share address space g)Threads synchronize by using mutexes

UNIX Process Management (2) The principal POSIX thread calls.

Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc. All rights reserved XP Process Management a)XP supports multiple processes b)Each process has at least one thread c)Scheduling is by thread d)fibers are threads created in user space e)Communicate thru pipes, named pipes, mailslots, sockets, remote procedure calls and shared files f)threads synchronize by semaphores, mutexes, critical sections, and events