System Software & Operating Systems Organization

Slides:



Advertisements
Similar presentations
Threads, SMP, and Microkernels
Advertisements

Operating System Structures
Chapter 2 Operating System Overview Operating Systems: Internals and Design Principles, 6/E William Stallings.
Operating-System Structures
Computer Systems/Operating Systems - Class 8
CMPT 300: Operating Systems I Dr. Mohamed Hefeeda
Lecture 1: History of Operating System
OS Fall ’ 02 Introduction Operating Systems Fall 2002.
Introduction to Operating Systems What is an operating system? Examples How do many programs run at the same time, with one processor?
OS Spring’03 Introduction Operating Systems Spring 2003.
Chapter 11 Operating Systems
©Brooks/Cole, 2003 Chapter 7 Operating Systems Dr. Barnawi.
Computer Organization and Architecture
1 Operating Systems Ch An Overview. Architecture of Computer Hardware and Systems Software Irv Englander, John Wiley, Bare Bones Computer.
Introduction Operating Systems’ Concepts and Structure Lecture 1 ~ Spring, 2008 ~ Spring, 2008TUCN. Operating Systems. Lecture 1.
Mehmet Can Vuran, Instructor University of Nebraska-Lincoln Acknowledgement: Overheads adapted from those provided by the authors of the textbook.
A. Frank - P. Weisberg Operating Systems Evolution of Operating Systems.
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3 Operating System Organization.
Chapter 2 Operating System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
Chapter 2 Operating System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
Computer Organization
Operating System A program that controls the execution of application programs An interface between applications and hardware 1.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 2: System Structures.
CHAPTER 2 OPERATING SYSTEM OVERVIEW 1. Operating System Operating System Definition A program that controls the execution of application programs and.
Chapter 1. Introduction What is an Operating System? Mainframe Systems
Operating Systems CS3502 Fall 2014 Dr. Jose M. Garrido
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3: Operating Systems Computer Science: An Overview Tenth Edition.
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
Composition and Evolution of Operating Systems Introduction to Operating Systems: Module 2.
Fall 2000M.B. Ibáñez Lecture 01 Introduction What is an Operating System? The Evolution of Operating Systems Course Outline.
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.
OPERATING SYSTEMS Goals of the course Definitions of operating systems Operating system goals What is not an operating system Computer architecture O/S.
INVITATION TO COMPUTER SCIENCE, JAVA VERSION, THIRD EDITION Chapter 6: An Introduction to System Software and Virtual Machines.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
Computers Operating System Essentials. Operating Systems PROGRAM HARDWARE OPERATING SYSTEM.
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3.
Distributed System Concepts and Architectures 2.3 Services Fall 2011 Student: Fan Bai
Processes Introduction to Operating Systems: Module 3.
Operating System Organization Chapter 3 Michelle Grieco.
Operating System Principles And Multitasking
Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.
Chapter 2 Operating System Overview Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
UNIX Unit 1- Architecture of Unix - By Pratima.
1 Lecture 1: Computer System Structures We go over the aspects of computer architecture relevant to OS design  overview  input and output (I/O) organization.
Copyright © Curt Hill Operating Systems An Introductory Overview.
Chapter 1 Basic Concepts of Operating Systems Introduction Software A program is a sequence of instructions that enables the computer to carry.
CS4315A. Berrached:CMS:UHD1 Introduction to Operating Systems Chapter 1.
Concepts and Structures. Main difficulties with OS design synchronization ensure a program waiting for an I/O device receives the signal mutual exclusion.
1 Operating System Overview Chapter 2. 2 Operating System A program that controls the execution of application programs An interface between applications.
Copyright © Curt Hill More on Operating Systems Continuation of Introduction.
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.
CT101: Computing Systems Introduction to Operating Systems.
Introduction to Operating Systems Concepts
Modularity Most useful abstractions an OS wants to offer can’t be directly realized by hardware Modularity is one technique the OS uses to provide better.
Chapter 2: System Structures
Operating System Structure
Introduction to Operating System (OS)
Quick Introduction to OS
Chapter 2: System Structures
Chapter 2: Operating-System Structures
Introduction to Operating Systems
Operating Systems : Overview
Operating Systems: A Modern Perspective, Chapter 3
Operating Systems : Overview
Chapter 2 Operating System Overview
Chapter 2: Operating-System Structures
In Today’s Class.. General Kernel Responsibilities Kernel Organization
Presentation transcript:

System Software & Operating Systems Organization CT213 – Computing Systems Organization

Contents System Software & OS OS organization OS design and implementation Implementation considerations Processor modes Kernel Requesting services from OS (command shell, system calls, messages) Processes User view

Computers and software Application software is designed to solve a specific problem System software provides a general programming environment Operating system is a subset of the system software Provide functions used by the application software Provides the mechanisms for application software to share the hardware in an orderly fashion Sharing increases the overall performance by allowing different application software to use different parts of the computer at the same time, decreasing the time to execute a collection of programs and increase overall system performance

System Software Runtime system for a programming language C libraries runtime Standard input/output (I/O) library – procedures to perform buffered input/output on a stream of data The math library – functions to perform various mathematical functions Graphics libraries – functions to render images on a bitmapped display Window system – software that provides a virtual terminal to an application program Database management system – can be used to store information on computer's permanent storage devices (such as disks); it provides abstract data types (called schema); Operating system – interacts directly with the hardware to provide an interface to other system software and with application software whenever it wants to use system’s resources It is application domain independent Provides resource abstraction Provides resources sharing (through strict resource management policies)

Resource abstraction It is done by providing an abstract model of the operation of the hardware components Abstraction generalizes the hardware behavior but restricts the flexibility With abstraction, certain operations became easy to perform, other may become impossible (such as specific hardware control) Different hardware components that an program may access are referred to as resources. Any particular resource, such as a HDD has a generic interface that defines how the programmer can make the resource perform a desired operation. An abstraction can be made to be much simpler than the actual resource interface Similar resources can be abstracted to a common abstract resource interface (i.e. system software may abstract floppy disks, hard-disks and CD-ROMs into a single abstract disk interface)

Resource sharing Abstract and physical resources may be shared among a set of concurrently executing programs: Space multiplexing sharing resource can be divided in two or more distinct units of the resource that can be used independently Different executing programs, or processes can be allocated exclusive control of different units of a resource at the same time; memory and HDD are examples of space multiplexed resources Time multiplexing sharing The resource is not spatially divisible; A process is allocated exclusive control of the entire resource for a short period of time After a time has elapsed, the resource is de-allocated from the process and allocated to another It is used with the processor resource, being switched among processes holding other resources such as memory space and network access

System software and the OS Application Software is using application programming interface to the system software The generic system software is using the operating system interface The operating system is using the software-hardware interface to interact with the hardware

Operating systems evolution Computers with no operating system Programming in machine language Lack of I/O devices OS rudiments Programming done in assembly Some basic I/O devices Some I/O control modules, assembler, debugger, loader, linker Batch processing systems – service a collection of jobs, called a batch, from a queue Job – predefined sequence of commands, programs and data combined into a single unit Job Control Language and monitor batch (interpreter for JCL) The user doesn’t interact with programs while they operate

Operating systems evolution … Operating systems using multiprogramming – the technique of loading multiple programs into space multiplexed memory while time-multiplexing the processor Timesharing systems Real time operating systems Distributed operating systems Multiprogramming systems common features Multitasking – multiple processes sharing machine resources Hardware support for memory protection and I/O devices Multi-user and multi-access support (through time sharing mechanisms) Optional support for real time operations (based on efficient usage of multitasking support) Interactive user interface Operating systems classification criteria Processor scheduling Memory management I/O management File management

Operating systems classification criteria Processor scheduling Memory management I/O management File management

Batch systems Processor scheduling : FIFO Memory management: Memory is divided in two parts: system memory and program memory (for programs) I/O management – no special problems, since a job has exclusive access to the I/O devices File management – present

Time sharing systems Support for multiprogramming and multi-user Processor scheduling time slice (round robin) Memory management: Protection and inter-process communication support I/O management Support for protection and sharing between users Is not critical in time File management Protection support and sharing support between users Multiple interactive sessions are implemented by a set of virtual machines, one for each user. Each user interacts with the computer by typing commands to the virtual machine (VM) on a virtual system console and receiving results back from the machine as soon as they are computed. Each user directs the virtual machine to execute specific commands. These commands are then executed on the physical machine in a multiprogramming environment Timesharing focuses on implementing policies to equitably share the processor between users. This allows the user to treat the virtual machine as a comparatively slower exclusive machine. Servicing the interrupts from terminals is critical in time

Real time operating systems Used whenever a large number of external events have to be treated in a short or limited interval of time Support for multiprogramming/multi-tasking Main goal Minimization of the response time to service the external events Processor scheduling: Priority based preemptive Memory management: Concurrent processes are loaded into the memory Support for protection and inter-process communication I/O management: Critical in time Processes dealing with I/O are directly connected to the interrupt vectors (or handling the interrupt requests) File management: It may be missing If exists, it should comply with requirements for timesharing systems + it should satisfy the requirements for real time systems

Distributed operating systems Multiprogramming induces a strong centralization tendency Distributed OS aims decentralization Based on computer network technologies, with afferent communication and synchronization protocols Client-server application architecture Security and protection are the primary concerns

Modern operating systems Modern operating systems evolved from all of the operating systems described previously: batch, time sharing, real time and distributed. They have inherited the properties from all of them (i.e. keep the processor load constant, from batch systems, multiprogramming from timesharing, critical processes served in real time and client server protocols from distributed systems).

OS organization Process and resource manager creates the process definition and execution environment on top of the hardware processor It uses the abstractions provided by the other managers Handles resource allocation Memory manager is typically distinct from the mechanism that manages other resources It is classically a separate part of the operating system Beside other functions, it is in charge with the implementation of the virtual memory The file manager is the part of the OS that abstracts device I/O operations into a relatively simple operation The device manger handles the details of reading and writing the physical devices (e.g. storage devices) and it is implemented within device driver

OS design – functional requirements Processes: Creation, termination, control, exception handling Protection Synchronization and communication Resources allocation/de-allocation Memory management: Allocation/de-allocation Protection and sharing I/O devices Physical resource abstraction File System management: Space allocation/de-allocation Protection, sharing, security

OS implementations Monolithic operating system try to achieve the functional requirements by executing all the code in the same address space to increase the performance of the system Too complex to manage Hierarchical operating system run most of their services in user space, aiming to improve maintainability and modularity of the codebase Suitable for OOP, the levels are very well defined

Implementation considerations Multi-programming Protection Processor modes Kernels Method of requesting a system service CPU modes (also called processor modes or CPU privilege levels) are operating modes for the CPU on some computer architectures that place restrictions on the operations that can be performed by the process currently running in the CPU. This design allows the OS to run at different privilege levels. These different privilege levels are called rings when referring to their implementation at the OS abstraction level, while CPU modes when referring to their implementation at the CPU firmware abstraction level. In principle, implementing hardware supported CPU modes correctly in the operating system code and in applications should make it impossible to introduce viruses, spyware, and/or similar malware as only very specific and limited "kernel" code would run unrestricted. Any other software (including portions of the operating system) would run restricted and would have to ask the "kernel" for permission to modify anything that could compromise the system. Multiple mode levels could be designed.

Multiprogramming (1) Technique that allows the system to present the illusion that multiple programs are running on the computer simultaneously Protection between programs is very important Many multiprogrammed computers are multiuser Allow multiple persons to be logged on at a time Beside protection, data privacy is also important Multiprogramming is achieved by switching rapidly between programs. Each program is allowed to execute for a fixed amount of time – timeslice The user programs don’t need to know that other programs are running on the system. The operating system in combination with the hardware provide protection for programs, preventing any program from accessing another’s program data unless the two programs have special arrangements to do so.

Multiprogramming (2) When a program timeslice ends, the OS stops it, removes it and gives another program control over processor – this is a context switch To do a context switch the OS copies the content of current program register file into memory, restores the contents of the next program’s register file into the processor and starts executing the next program. From the program point of view, they can’t tell that a context switch has been performed Old computers used to context switch about 60 times per second. This gives the illusion, if a relative small number of processes are executing on the computer, that each individual program is having full control over the machine. Now-days, the modern computers are actually switching more often between programs.

Protection (1) The result of any program running on a muliprogrammed computer must be the same as if the program was the only program running on the computer Programs must not be able to aces other program’s data and must be confident that their data will not be modified by other programs. Programs must not interfere with other program’s use of I/O devices

Protection (2) Protection is achieved by having the operating system to have full control over the resources of the system (processor, memory and I/O devices) Virtual memory is one of the techniques used to achieve protection between programs Each program operates as if it were the only program on the computer, occupying a full set of the address space in its virtual space. The OS is translating memory addresses that the program references into physical addresses used by the memory system. As long as two program’s addresses are not translated to same address space, programs can be written as they were the only ones running on the machine

Privileged Mode To ensure that the operating system is the only one that can control the physical resources it executes in privileged mode User programs execute in user mode When user mode programs want to execute something that requires privileged rights, it sends a request to the OS, known as system call, that asks the OS to do the operation for them OS is also responsible for low level UI Keys are pressed, the OS is responsible to determine which program should receive the input When a program wants to display some output, the user program executes some system call that displays the data

Processor Modes Are operating modes for the CPU that place restrictions on the operations that can be performed by the currently running process Hardware supported CPU modes help the operating system to enforce rules that would prevent viruses, spyware, and/or similar malware to run Only very specific and limited "kernel" code would run unrestricted. Any other software (including portions of the operating system) would run restricted and would have to ask the "kernel" for permission to modify anything that could compromise the system. Multiple mode levels could be designed.

Processor modes … Mode bit to define execution capability of program on a processor Supervisor mode The processor can execute any instruction Instructions that can be executed only in supervisor mode are called supervisor, privileged or protected instructions (e.g. I/O instructions) User mode The processor can execute a subset of the instruction set Some microprocessors do not make a difference between protected and user mode (i.e. 8086) The mode bit may be logically extended to define areas of memory to be used when the processor is in supervisor mode versus when it is in user mode

Supervisor and user memory If mode bit is set to supervisor mode, then the execution process has access on both memory spaces If user mode is set, then the executing process has access only to the user space In general, the mode bit extends the operating system’s protection rights; usually the mode bit is set by the interrupts, making the processor to jump to a location in the system space, to execute a system routine; it is similar to a hardware interrupt; once the processor finishes the execution of the system call, it resets the mode bit and returns.

Kernels The part of the operating system that executes in supervisor mode is called kernel or nucleus Operates as trusted software Implements protection mechanisms that could not be changed through the actions of un-trusted software executing in user mode Extensions of the OS can operate in user mode Provides the lowest level abstraction layer for resources (memory, processor(s) and IO devices) Fundamental design decision – if a given function of the operating system is to be incorporated in the kernel or not Protection issues Performances issues

Method of requesting a system service Through command interface By calling a specific command using a command interpreter known as shell From user processes requesting services from OS: By calling a system function By sending a message to a system process

Command execution mechanism A key pressed by the user generates a hardware interrupt Specialized module of the OS reads the keyed character and the stores it in a special command line buffer There are special characters (i.e. to edit the command line, that are not stored in the command line buffer) End of line detected - control taken by the command interpreter (shell): Analysis of the command (with error or success) If success, then the command interpreter decides if it is about an internal or external command (for another module) If internal command – tries the execution, that can end successfully or with error If external Looking for the corresponding executable file Launching in execution with the detected parameters from previous phase

Command execution example Semantics of grep establish that first string parameter (first) represents the search pattern, while the second parameter represents a file name (where to search)

System call The parameters of the call are passed according to some OS specific convention and hardware architecture Switch in protected (supervisor) mode using a specific mechanism (software interrupt, trap, special instruction of type “call supervisor”), mechanism that is different from a normal call A special module takes over, that will analyze the parameters and the access rights; this module can reject the system call If accepted, then the corresponding routine from the operating system is executed and the result is returned to the user; upon return, the user mode is restored A system call is a request made by any arbitrary program to the operating system for performing tasks -- picked from a predefined set -- which the said program does not have required permissions to execute in its own flow of execution. System calls provide the interface between a process and the operating system itself. Implementing system calls requires a control transfer which involves some sort of architecture specific feature. A typical way to implement this is to use a software interrupt or trap. Interrupts transfer control to the OS so software simply needs to set up some register with the system call number they want and execute the software interrupt. For many RISC processors this is the only feasible implementation, but CISC architectures such as x86 support additional techniques. One example is SYSCALL/SYSRET which is very similar to SYSENTER/SYSEXIT (the two mechanisms were created by Intel and AMD independently, but do basically the same thing). These are "fast" control transfer instructions that are designed to quickly transfer control to the OS for a system call without the overhead of an interrupt. Linux 2.5 began using this on the x86, where available; formerly it used the INT instruction, where the system call number was placed in the EAX register before interrupt 0x80 was executed.

Messages User process constructs a message that describes a desired service (A) Uses send function to pass the message to a trusted operating system process The send function checks the message, switches the processor in protected mode and then delivers the message to the process that implements the target function Meanwhile, the user waits for result with a message receive operation. When the kernel finishes to process the request, it sends a message (B) back to the user process

References “Operating Systems – A modern perspective”, Garry Nutt, ISBN 0-8053-1295-1