UNIX rewritten using C (Dennis Ritchie) UNIX (v7) released (ancestor of most UNIXs).

Similar documents
Chapter 10: Case Studies. So what happens in a real operating system?

Chapter 8 Virtual Memory

Introduction to OS. File Management. MOS Ch. 4. Mahmoud El-Gayyar. Mahmoud El-Gayyar / Introduction to OS 1

Lecture Topics. Announcements. Today: Operating System Overview (Stallings, chapter , ) Next: Processes (Stallings, chapter

Example Sheet for Operating Systems I (Part IA)

Module A: The FreeBSD System

Module A: The FreeBSD System

Chapter 8: Virtual Memory. Operating System Concepts

Appendix A: FreeBSD. Operating System Concepts 9 th Edition

To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization

Example Sheet for Operating Systems I (Part IA)

Four Components of a Computer System

CS2028 -UNIX INTERNALS

File. File System Implementation. Operations. Permissions and Data Layout. Storing and Accessing File Data. Opening a File

B. V. Patel Institute of Business Management, Computer &Information Technology, UTU

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

Operating Systems Design Exam 2 Review: Spring 2011

CSE 120 PRACTICE FINAL EXAM, WINTER 2013

CS 416: Opera-ng Systems Design March 23, 2012

CS370 Operating Systems

Techno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions:

Operating Systems, Fall

Operating System Concepts

Module 20: The UNIX System. History

Noorul Islam College Of Engineering, Kumaracoil MCA Degree Model Examination (October 2007) 5 th Semester MC1642 UNIX Internals 2 mark Questions

Unix SVR4 (Open Solaris and illumos distributions) CPU Scheduling

Workloads. CS 537 Lecture 16 File Systems Internals. Goals. Allocation Strategies. Michael Swift

CS 318 Principles of Operating Systems

Chapter 11: File System Implementation. Objectives

Chapter 1: Introduction

OPERATING SYSTEM. Chapter 9: Virtual Memory

a process may be swapped in and out of main memory such that it occupies different regions

HIGH PERFORMANCE COMPUTING: MODELS, METHODS, & MEANS OPERATING SYSTEMS 1

Lecture 21: Reliable, High Performance Storage. CSC 469H1F Fall 2006 Angela Demke Brown

Memory Management Outline. Operating Systems. Motivation. Paging Implementation. Accessing Invalid Pages. Performance of Demand Paging

Computer Systems Laboratory Sungkyunkwan University

CS370 Operating Systems

Lecture 1 Introduction (Chapter 1 of Textbook)

CS2506 Quick Revision

Chapter 9: Virtual Memory

The Operating System Machine Level

With regard to operating systems the kernel consists of the most frequently used functions in the operating system and it kept in main memory.

File System Internals. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Logical disks. Bach 2.2.1

CS 318 Principles of Operating Systems

CSC 553 Operating Systems

Chapter 11: Implementing File Systems

Linux Operating System

Disks and I/O Hakan Uraz - File Organization 1

Swapping. Operating Systems I. Swapping. Motivation. Paging Implementation. Demand Paging. Active processes use more physical memory than system has

Objectives and Functions Convenience. William Stallings Computer Organization and Architecture 7 th Edition. Efficiency

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System

UNIX File System. UNIX File System. The UNIX file system has a hierarchical tree structure with the top in root.

Chap 7, 8: Scheduling. Dongkun Shin, SKKU

Operating System Support

(MCQZ-CS604 Operating Systems)

CS307: Operating Systems

Local File Stores. Job of a File Store. Physical Disk Layout CIS657

First-In-First-Out (FIFO) Algorithm

OPERATING SYSTEM. Chapter 12: File System Implementation

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

Notes based on prof. Morris's lecture on scheduling (6.824, fall'02).

Mon Sep 17, 2007 Lecture 3: Process Management

INTRODUCTION TO OPERATING SYSTEMS. Jo, Heeseung

Memory Management. To improve CPU utilization in a multiprogramming environment we need multiple programs in main memory at the same time.

Chapter 5. File and Memory Management

Chapter 11: Implementing File Systems

Advanced Operating Systems (CS 202) Scheduling (1)

UNIX File Systems. How UNIX Organizes and Accesses Files on Disk

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski

CS3600 SYSTEMS AND NETWORKS

European University of Lefke. Instructor: Dr. Arif SARI

Chapter 8 Virtual Memory

12: Memory Management

Chapter 12: File System Implementation

Introduction to Operating Systems

CSE 4/521 Introduction to Operating Systems. Lecture 27 (Final Exam Review) Summer 2018

Block Device Scheduling. Don Porter CSE 506

Block Device Scheduling

COMP 3361: Operating Systems 1 Final Exam Winter 2009

Announcements. Reading. Project #1 due in 1 week at 5:00 pm Scheduling Chapter 6 (6 th ed) or Chapter 5 (8 th ed) CMSC 412 S14 (lect 5)

Lecture 19: File System Implementation. Mythili Vutukuru IIT Bombay

Virtual Memory Outline

CPS221 Lecture: Operating System Protection

Introduction to Operating Systems. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

V. File System. SGG9: chapter 11. Files, directories, sharing FS layers, partitions, allocations, free space. TDIU11: Operating Systems

Advanced file systems: LFS and Soft Updates. Ken Birman (based on slides by Ben Atkin)

CS604 Final term Paper Fall (2012)

ELEC 377 Operating Systems. Week 1 Class 2

Memory management. Requirements. Relocation: program loading. Terms. Relocation. Protection. Sharing. Logical organization. Physical organization

File System Internals. Jo, Heeseung

CS370 Operating Systems

ICS Principles of Operating Systems

Introduction to Operating Systems. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Virtual Memory. Chapter 8

Introduction to Operating Systems. Jo, Heeseung

CS510 Operating System Foundations. Jonathan Walpole

Operating Systems. Operating Systems

Processes Prof. James L. Frankel Harvard University. Version of 6:16 PM 10-Feb-2017 Copyright 2017, 2015 James L. Frankel. All rights reserved.

File Management. Chapter 12

Transcription:

UNIX: HISTORY: 1. 1969 UNIX developed (Ken Thompson). 2. 1972 UNIX rewritten using C (Dennis Ritchie). 3. 1976 UNIX (v6) released for commercial use. 4. 1978 UNIX (v7) released (ancestor of most UNIXs). 5. 1978 The UNIX Support Group (USG) assumes control of UNIX 6. 1978 3BSD (Berkeley Software Distributions) adds virtual memory, demand paging, and page replacement to UNIX (v7)/(32v). 7. 1979 4BSD adds support for internet protocols, improved terminal line editing features, the C shell, VI, and Pascal and LISP compilers. 8. 1980 Xenix (MicroSoft) derived from UNIX (v7). 9. 1982 System III adds some real-time features and a set of software tools to UNIX (v7). 10. 1983 System V improves on system III. 11. 1983 4.2BSD improves on 4BSD. 12. 1984 System V (v.2.4) adds virtual memory with copy-onwrite paging and shared memory. 13. 1984 Sun OS derived from 4.2BSD. 14. 1988 4.3BSD improves networking and TCP/IP performance. 15. 1993 4.4BSD includes X.25 networking, POSIX compliant interface, a new file system, a version of NFS, enhanced security, and improved kernel structuring. This was the last release from BSD. 16. 1993 Solaris 2 derived from System V (v.4.4). 17. 1993 Novell purchases Unix System Labs (originally USG).

DESIGN GOALS: The unique design of UNIX can be attributed to: 1. The first version was designed and built by two people (the small number of people involved led to its coherence like Pascal). 2. The people who built UNIX also used it (which mean it is simple to understand). The design goals where: 1. Keep the operating system simple. 2. Keep the operating system general. For example: a) The same system calls are used to read (or write) files, devices, and interprocess message buffers. b) The same naming, aliasing, and access protection mechanisms apply to data, directories, and devices. c) The same mechanism is used to trap software interrupts and processor traps. 3. Create an environment where large tasks can be created from existing small tasks (using pipes and filters).

PROCESS CONTROL: Processed are represented by various control blocks which are stored in kernel space (protected space). This includes the process control block (sometimes referred to as an image). The storage component is divided into 3 parts: the text (program code), stack, and data. The stack and data sections are stored in the same address space. The text segment is stored in a different region (segment) of memory. Data Stack

CPU SCHEDULING: CPU scheduling is a time-shared priority scheme (if all processes have the same priority the approach reduces to a round-robin scheme). The scheduler uses negative feedback to dynamically adjust process priorities (the more time a process accumulates the lower its priority goes and vise versa). Process aging is used to prevent starvation. The time quantum on newer versions of UNIX is 0.1 second. Priorities are recomputed every second. Processes cannot preempt other processes. Once a process has the CPU it keeps it until its time quantum is up or it requires I/O. When a process requires I/O it goes to sleep and waits. When the system completes the I/O, it wakes the sleeping process (or processes), which is (are) then put back on the ready queue. When the process next runs, it collects the I/O data. Note that the effect of negative feedback and process aging could result in the following effect: 1. A long running CPU hog program starts up with high priority. 2. As it runs and accumulates CPU time, its priority continually drops. 3. As its priority drops, other higher-priority processes begin to consume more and more of the CPU cycles until our process gets none. 4. At this point due to aging, our process priority level is increased until our process again gets some CPU time. 5. Go back to step 2. In a heavily loaded system, we can easily end up in a situation like:

Hi Priority Lo Time Where a long running and CPU intensive process sinks to the bottom of the priority pool and waffles around down there with just enough priority to stay alive. What if this process is also a memory hog? What would the effects of swapping and/or paging (caused by this process) have on the overall system performance? Remember, to reduce the performance degradations caused by paging,that it is best to let a memory hog program finish first. Is UNIX designed to handle these types of processes?

MEMORY MANAGEMENT - SWAPPING: Early versions of UNIX used contiguous allocation for memory and swap space. A process larger than the physical memory could not run at all. If a large process was scheduled to run, many other processes would have to be swapped out. Memory and swap allocation was done first-fit. Swap decisions were made every 4 seconds by the swap scheduler (a medium-term scheduler). A process was more likely to be swapped out if it was idle, been in memory a long time, or was large. A process was more likely to be swapped in if it was small or had been in swap space a long time. Newer versions use paging methods for memory and swap space management. However, swapping (as implemented above) is still used as a secondary means of memory management. Most versions of UNIX use demand paging. Demand paging is done in a straightforward manner (sort of): 1. When a memory section is needed that is not already in memory, a page fault occurs. 2. If the page had been previously loaded, but was marked for removal (at the time it was no longer needed). It can be reused. 3. In many cases most pages (belonging to a process) are loaded when the process loads (prefetching). 4. If a page is to be loaded from disk, it must be locked in memory. This prevents some other processes page fault from removing it before it can even be used. 5. If a page is being used, it must also be locked in memory.

6. There are also checks to insure that the number of valid pages for a process do not fall too low (a global vs local page replacement check) as this would tend to increase the number of page faults generated. 7. There is also a check to prevent a process from gobbling up too much memory. 8. If the scheduler decides that the system is overloaded, whole processes will be swapped out to relieve the problem.

FILE SYSTEM: UNIX uses Inodes to represent files. UNIX uses Inodes to represent directories (which are just files with a special structure). UNIX uses a linear search to find files in the directory. UNIX treats hard links as directory entries. UNIX treats soft links as pointers to another location in the directory. When traversing a soft link, UNIX prevents infinite loops from occurring by counting the number of soft links encountered during the traversal (the limit is 8). UNIX uses kernel-level tables (1 table per process) to monitor open files. The table points to a file-structure table. The file-structure table points to the in-memory version of the Inode (for the file) and keeps track of the current location (to be read/wrote) in the file. User space Kernel space Disk space Open file table 1 File structure table Inode list Data blocks Process 1 Inode list Process 2 Synced Open file table 2 File offsets (to next datum) The open file table has a fixed length. Therefore, there is some limit to the number of open files.

UNIX file system can span many physical drives. To incorporate a new file system, it must be mounted (integrated into the root file system). The Inode of any file system which includes other mounted file systems has a bit set. This bit tells the system to search the mount table for the device number of the mounted device. The device number is used to find the root Inode for the mounted file system. UNIX records free blocks in a linked list. Free blocks are pushed into the front of the free list and removed from the front of the free list as needed. Thus, after time the file system will become fragmented. The superblock (contains the size of the disk, the boundaries of file systems, and the overall layout of the file system) of each mounted file system is kept in memory (for speedy accesses). Every 30 seconds the superblock is written to the disk (for longer term, nonvolatile storage). If the system crashes, we must examine all of the blocks on all file systems on boot-up to rebuild the superblock. This problem still exists today. Variations of free block management and superblock management do exist. However, in some cases (4.2BSD) the variation decreases (wastes) drive capacity to improve on access rates or reliability.

I/O SYSTEM: The I/O system is designed to hide the peculiarities of I/O devices from the kernel. 3 types of I/O: 1. Block devices Block devices are directly addressable using a fixed block size (disks and tapes are block devices). 2. Socket devices Socket devices are network devices. 3. Character devices Character devices are everything else (terminals, line printers, /dev/mem, /dev/null, etc). BLOCK BUFFER CACHE: Block devices use a block buffer cache. 1. When a block is wanted from a block device, the block buffer cache is searched first. 2. When a block is written to a block device, the block buffer cache is searched first. If the block is not found, a free block is used. In either case, dirty bits are used to indicate a change to the buffer. 3. Periodically, blocks with dirty bits are force written to the block device. Increasing the size of the buffer cache, usually improves system performance. Use of the buffer cache also allows the disk system to better schedule (to minimize head movements) writes. However, reads are not affected.

IN A NUTSHELL: UNIX was not designed to be used on a large scale commercial computing type of machine. Hardware performance was not one of the design precepts. UNIX was designed to cater to multiprogrammed interactive processes. Not to long running, CPU hungry applications.