CHAPTER 2 - SYSTEM STRUCTURES

Similar documents
Example of Standard API

Objectives. Chapter 2: Operating-System Structures. Operating System Services (Cont.) Operating System Services. Operating System Services (Cont.

Chapter 2: Operating-System Structures. Operating System Concepts 9 th Edition

CS3600 SYSTEMS AND NETWORKS

Operating System Structures

CS420: Operating Systems OS Services & System Calls

Chapter 2 System Structures

System Structures. Services Interface Structure

OPERATING SYSTEM SERVICES

Kernel Types System Calls. Operating Systems. Autumn 2013 CS4023

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

How do Users and Processes interact with the Operating System? Services for Processes. OS Structure with Services. Services for the OS Itself

Chapter 3 Operating-System Structures

Operating System Structure

Chapter 3: Operating-System Structures. Common System Components

Lecture 1 Operating System Overview

Chapter 3: Operating-System Structures. System Components Operating System Services System Calls System Programs System Structure Virtual Machines

Review from last time. CS 537 Lecture 3 OS Structure. OS structure. What you should learn from this lecture

ELEC 377. Operating Systems. Week 1 Class 3

CS 3530 Operating Systems. L02 OS Intro Part 1 Dr. Ken Hoganson

CPS221 Lecture: Operating System Structure; Virtual Machines

Operating- System Structures

Operating System Components

Lesson 06: Basics of Software Development (W02D2

CHAPTER 15: Operating Systems: An Overview

CSE 120 Principles of Operating Systems. Modules, Interfaces, Structure

Android Basics. Xin Yang

Multiprogramming. IT 3123 Hardware and Software Concepts. Program Dispatching. Multiprogramming. Program Dispatching. Program Dispatching

Operating Systems and Networks

Mobility Introduction Android. Duration 16 Working days Start Date 1 st Oct 2013

Technology in Action. Alan Evans Kendall Martin Mary Anne Poatsy. Eleventh Edition. Copyright 2015 Pearson Education, Inc.

How To Write A Windows Operating System (Windows) (For Linux) (Windows 2) (Programming) (Operating System) (Permanent) (Powerbook) (Unix) (Amd64) (Win2) (X

Outline. hardware components programming environments. installing Python executing Python code. decimal and binary notations running Sage

Operating Systems 4 th Class

Discovering Computers

Operating System Structures

Overview of CS 282 & Android

Chapter 8 Objectives. Chapter 8 Operating Systems and Utility Programs. Operating Systems. Operating Systems. Operating Systems.

Cisco Networking Academy Program Curriculum Scope & Sequence. Fundamentals of UNIX version 2.0 (July, 2002)

A+ Guide to Managing and Maintaining Your PC, 7e. Chapter 2 Introducing Operating Systems

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 1 Android SDK & Development Environment. Marco Picone

OS Concepts and structure

Reminders. Lab opens from today. Many students want to use the extra I/O pins on

INTRODUCTION TO OPERATING SYSTEMS

Providing a jump start to EFI application development and a uniform pre-boot environment

Lecture 1 Introduction to Android

Operating System Components and Services

LSN 10 Linux Overview

Introduction to Virtual Machines

Running a Program on an AVD

Chapter 14 Virtual Machines

Operating System Organization. Purpose of an OS

RDM+ Remote Desktop for Android. Getting Started Guide

Android Architecture. Alexandra Harrison & Jake Saxton

At Your Service Repair Centre Installation Guide

CS197U: A Hands on Introduction to Unix

Fall Lecture 1. Operating Systems: Configuration & Use CIS345. Introduction to Operating Systems. Mostafa Z. Ali. mzali@just.edu.

Issues in Android on Mobile Platform and Their Resolution

OPERATING SYSTEMS STRUCTURES

Unit 4 Objectives. System Software. Component 4: Introduction to Information and Computer Science. Unit 4: Application and System Software Lecture 2

ITG Software Engineering

Android Operating System

Mobile Phones Operating Systems

After studying this lesson, you will have a clear understanding of, what an Operating System is. functions of an Operating System

Fastboot Techniques for x86 Architectures. Marcus Bortel Field Application Engineer QNX Software Systems

Do you know what makes NetSupport Manager so unique?

Chapter 8 Operating Systems and Utility Programs

Outline: Operating Systems

Operating system Dr. Shroouq J.

Operating Systems Overview As we have learned in working model of a computer we require a software system to control all the equipment that are

10 STEPS TO YOUR FIRST QNX PROGRAM. QUICKSTART GUIDE Second Edition

The Android Platform

OMX, Android, GStreamer How do I decide what to use? 15 July 2011

Operating System Software

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

STUDY GUIDE CHAPTER 4

CS161: Operating Systems

Network Licensing. White Paper 0-15Apr014ks(WP02_Network) Network Licensing with the CRYPTO-BOX. White Paper

Operating System Today s Operating Systems File Basics File Management Application Software

4.1 Introduction 4.2 Explain the purpose of an operating system Describe characteristics of modern operating systems Control Hardware Access

Chapter 1. Introduction to ios Development. Objectives: Touch on the history of ios and the devices that support this operating system.

Web Conferencing Version 8.3 Troubleshooting Guide

CatDV Pro Workgroup Serve r

Zend Server 4.0 Beta 2 Release Announcement What s new in Zend Server 4.0 Beta 2 Updates and Improvements Resolved Issues Installation Issues

Chapter Contents. Operating System Activities. Operating System Basics. Operating System Activities. Operating System Activities 25/03/2014

Here is a demonstration of the Aqua Accelerated Protocol (AAP) software see the Aqua Connect YouTube Channel

ReactOS is (not) Windows. Windows internals and why ReactOS couldn t just use a Linux kernel

Software systems and issues

Mobile Operating Systems. Week I

Operating System Overview. Otto J. Anshus

How To Install An Aneka Cloud On A Windows 7 Computer (For Free)

Open Source Project from China. Northeast Asia Open Source SoftwareCompetition Nov. 2012

RDM+ Desktop for Windows Getting Started Guide

Developing Applications for ios

Virtualization and the U2 Databases

Operating Systems. and Windows

Computers: Tools for an Information Age

Functions of NOS Overview of NOS Characteristics Differences Between PC and a NOS Multiuser, Multitasking, and Multiprocessor Systems NOS Server

Transcription:

CHAPTER 2 - SYSTEM STRUCTURES 1

OBJECTIVES To describe the services an operating system provides to users, processes, and other systems To discuss the various ways of structuring an operating system To explain how operating systems are installed and customized and how they boot

OPERATING-SYSTEM SERVICES 3. 12

OPERATING-SYSTEM SERVICES

USER INTERFACE Almost all operating systems have a user interface (UI). Varies between Command-Line (CLI) Graphics User Interface (GUI) Batch 3. 2

PROGRAM EXECUTION The system must be able to load a program into memory and to run that program, end execution, either normally or abnormally (indicating error) 3. 34

I/O OPERATIONS A running program may require I/O, which may involve a file or an I/O device 3. 5

FILE-SYSTEM MANIPULATION The file system is of particular interest. Programs need to read and write files and directories create and delete them search them list file Information permission management.

COMMUNICATIONS Processes may exchange information, on the same computer or between computers over a network Communications may be via shared memory or through message passing (packets moved by the OS) 3. 67

ERROR DETECTION OS needs to be constantly aware of possible errors May occur in the CPU and memory hardware, in I/O devices, in user program For each type of error, OS should take the appropriate action to ensure correct and consistent computing Debugging facilities can greatly enhance the user s and programmer s abilities to efficiently use the system

RESOURCE ALLOCATION When multiple users or multiple jobs running concurrently, resources must be allocated to each of them Many types of resources - Some (such as CPU cycles, main memory, and file storage) may have special allocation code, others (such as I/O devices) may have general request and release code 3. 8

ACCOUNTING Accounting - To keep track of which users use how much and what kinds of computer resources 33. 10. 9

PROTECTION AND SECURITY The owners of information stored in a multiuser or networked computer system may want to control use of that information, concurrent processes should not interfere with each other Protection involves ensuring that all access to system resources is controlled Security of the system from outsiders requires user authentication, extends to defending external I/O devices from invalid access attempts

USER AND OPERATING-SYSTEM INTERFACE 34. 11. 1

CLI CLI or command interpreter allows direct command entry Sometimes implemented in kernel, sometimes by systems program Sometimes multiple flavors implemented shells Primarily fetches a command from user and executes it Sometimes commands built-in, sometimes just names of programs If the latter, adding new features doesn t require shell modification

GUI User-friendly desktop metaphor interface Usually mouse, keyboard, and monitor Icons represent files, programs, actions, etc Various mouse buttons over objects in the interface cause various actions Invented at Xerox PARC 4. 2

CLI & GUI Many systems now include both CLI and GUI interfaces Microsoft Windows is GUI with CLI command shell Apple Mac OS X is "Aqua" GUI interface with UNIX kernel underneath and shells available Unix and Linux have CLI with optional GUI interfaces (CDE, KDE, GNOME) 4. 3

TOUCHSCREEN INTERFACES Touchscreen devices require new interfaces Mouse not possible or not desired Actions and selection based on gestures Virtual keyboard for text entry 4. 4

TOUCHSCREEN INTERFACES 4. 5

CHOICE OF INTERFACE System administrators who manage computers and power users who have deep knowledge of a system frequently use the command-line interface. On some systems, only a subset of system functions is available via the GUI Shell scripts are very common on systems that are command-line oriented 4. 6

SYSTEM CALLS 45. 71

SYSTEM CALLS Programming interface to the services provided by the OS Typically written in a high-level language (C or C++) Mostly accessed by programs via a high-level Application Program Interface (API) rather than direct system call

Win32 API for Windows SYSTEM CALLS APIS Three most common APIs are: POSIX API for POSIX-based systems (including virtually all versions of UNIX, Linux, and Mac OS X) Java API for the Java virtual machine (JVM) Why use APIs rather than system calls? 5. 2

EXAMPLE OF SYSTEM CALLS 5. 3

EXAMPLE OF STD API 5. 4

SYSTEM CALLS 5. 5

SYSTEM CALLS Most programming languages have run-time support Set of functions built into libraries included with a compiler provides a system-call interface link to system calls made available by the operating system. Typically, a number is associated with each system call System-call interface maintains a table indexed according to these numbers.

SYSTEM CALL APIS The caller need know nothing about how the system call is implemented or what it does during execution. Rather, the caller need only obey the API and understand what the operating system will do as a result of the execution of that system call. 5. 67

STANDARD LIBRARY 5. 8

PASSING PARAMETERS 3 general methods to pass parameters to the OS. In registers Simplest stored in a block, or table, in memory, and the address of the block is passed as a parameter in a register Linux & Solaris placed, or pushed, onto the stack by the program and popped off the stack by the operating system do not limit the number or length of parameters 5. 9

SYSTEM CALLS 5. 10

TYPES OF SYSTEM CALLS 56. 11. 1

GROUPS OF SYSTEM CALLS Process control File manipulation Device manipulation Information maintenance Communications Protection.

SYSTEM CALLS EXAMPLES 6. 2

PROCESS CONTROL end, abort load, execute create process, terminate process get process attributes, set process attributes wait for time wait event, signal event allocate and free memory

PROCESS CONTROL Dump memory if error Debugger for determining bugs, single step execution To ensure integrity between shared data Locks for managing access 6. 34

MS-DOS 6. 5

FREEBSD 6. 6

FILE MANAGEMENT create file, delete file open, close file read, write, reposition get and set file attributes 6. 7

DEVICE MANAGEMENT request device, release device read, write, reposition get device attributes, set device attributes logically attach or detach devices 6. 8

INFORMATION MAINTENANCE get time or date, set time or date get system data, set system data get and set process, file, or device attributes single step trap executed after each command caught by debugger 6. 9

COMMUNICATION Create, delete communication connection Send, receive messages if message passing model to host name or process name From client to server Shared-memory model create and gain access to memory regions Transfer status information Attach and detach remote devices 6. 10

PROTECTION Control access to resources Get and set permissions Allow and deny user access 6. 11 12

SYSTEM PROGRAMS 7. 1

SYSTEM PROGRAMS System programs provide a convenient environment for program development and execution. Most users view of the operation system is defined by system programs, not the actual system calls Provide a convenient environment for program development and execution Some of them are simply user interfaces to system calls; others are considerably more complex

SYSTEM PROGRAMS File management Status information File modification Programming language support Program loading and execution Communications Background services Application programs 7. 2

FILE MANAGEMENT Create, delete, copy, rename, print, dump, list, and generally manipulate files and directories 7. 34

STATUS INFORMATION Some ask the system for info - date, time, amount of available memory, disk space, number of users Others provide detailed performance, logging, and debugging information Typically, these programs format and print the output to the terminal or other output devices Some systems implement a registry - used to store and retrieve configuration information

FILE MODIFICATION Text editors to create and modify files Special commands to search contents of files or perform transformations of the text 7. 56

PROGRAMMING LANGUAGE SUPPORT Compilers, assemblers, debuggers and interpreters sometimes provided 7. 7

PROGRAM LOADING AND EXECUTION Absolute loaders, relocatable loaders, linkage editors, and overlay-loaders, debugging systems for higher-level and machine language 7. 8

COMMUNICATIONS Provide the mechanism for creating virtual connections among processes, users, and computer systems Allow users to send messages to one another s screens, browse web pages, send electronic-mail messages, log in remotely, transfer files from one machine to another

BACKGROUND SERVICES Launch at boot time Some for system startup, then terminate Some from system boot to shutdown Provide facilities like disk checking, process scheduling, error logging, printing Run in user context not kernel context Known as services, subsystems, daemons 7. 9

APPLICATION PROGRAMS Don t pertain to system Run by users Not typically considered part of OS Launched by command line, mouse click, finger poke 7. 10

OPERATING-SYSTEM DESIGN AND IMPLEMENTATION 78. 11. 1

OPERATING-SYSTEM DESIGN AND IMPLEMENTATION Design and Implementation of OS not solvable, but some approaches have proven successful Internal structure of different Operating Systems can vary widely Affected by choice of hardware, type of system

User goals DESIGN GOALS Start by defining goals and specifications should be convenient to use, easy to learn, reliable, safe, and fast System goals should be easy to design, implement, and maintain, as well as flexible, reliable, error-free, and efficient 8. 2

MECHANISMS AND POLICIES Important to separate Policy: What will be done? Mechanism: How to do it? The separation of policy from mechanism is a very important principle, it allows maximum flexibility if policy decisions are to be changed later 8. 3

IMPLEMENTATION Much variation Early OSes in assembly language Then system programming languages like Algol, PL/1 Now C, C++ 8. 4

IMPLEMENTATION Actually usually a mix of languages Lowest levels in assembly Main body in C Systems programs in C, C++, scripting languages like PERL, Python, shell scripts More high-level language easier to port to other hardware But slower Emulation can allow an OS to run on non-native hardware 8. 5

OPERATING-SYSTEM STRUCTURE 89. 61

OPERATING-SYSTEM STRUCTURE General-purpose OS is very large program Various ways to structure one as follows 9. 2

SIMPLE STRUCTURE 9. 3

MS-DOS LAYER STRUCTURE

UNIX SYSTEM STRUCTURE UNIX limited by hardware functionality, the original UNIX OS had limited structuring. Consists of two separable parts 1. Systems programs 2. The kernel Consists of everything below the system-call interface and above the physical hardware Provides the file system, CPU scheduling, memory management, and other operating-system functions; a large number of functions for one level 9. 4

UNIX SYSTEM STRUCTURE 9. 5

LAYERED APPROACH

MICROKERNELS Moves as much from the kernel into user space Mach example of microkernel Mac OS X kernel (Darwin) partly based on Mach Communication takes place between user modules using message passing 9. 67

MICROKERNELS Benefits Easier to extend a microkernel Easier to port the operating system to new architectures More reliable (less code is running in kernel mode) More secure Detriments: Performance overhead of user space to kernel space communication 9. 8

MICROKERNELS 9. 9

MODULES Most modern operating systems implement loadable kernel modules Uses object-oriented approach Each core component is separate Each talks to the others over known interfaces Each is loadable as needed within the kernel 9. 10

MODULES Overall, similar to layers but with more flexibility, as all modules can call other modules Used in modern UNIX (Solaris), Linux, Mac OS and Windows 9. 11 12

SOLARIS LOADABLE MODULES

HYBRID SYSTEMS Most modern operating systems actually not one pure model Hybrid combines multiple approaches to address performance, security, usability needs 9. 13 14

HYBRID SYSTEMS Linux and Solaris kernels in kernel address space, so monolithic, plus modular for dynamic loading of functionality Windows mostly monolithic, plus microkernel for different subsystem personalities Apple Mac OS X hybrid, layered, Aqua UI plus Cocoa programming environment

MAC OS X STRUCTURE 9. 15

IOS Apple mobile OS for iphone, ipad Structured on Mac OS X, added functionality Does not run OS X applications natively Also runs on different CPU architecture (ARM vs. Intel) Cocoa Touch Objective-C API for developing apps Media services layer for graphics, audio, video Core services provides cloud computing, databases Core operating system, based on Mac OS X kernel 9. 16

IOS 9. 17

ANDROID Developed by Open Handset Alliance (mostly Google) Open Source Similar stack to IOS Based on Linux kernel but modified Provides process, memory, device-driver management Adds power management Runtime environment includes core set of libraries and Dalvik virtual machine 9. 18

ANDROID Apps developed in Java plus Android API Java class files compiled to Java bytecode then translated to executable than runs in Dalvik VM Libraries include frameworks for web browser (webkit), database (SQLite), multimedia, smaller libc 9. 19

ANDROID ARCHITECHTURE 9. 20

OPERATING-SYSTEM DEBUGGING 10. 1

DEBUGGING Debugging: The activity of finding and fixing errors in a system, both in hardware and in software 910. 21. 2

FAILURE ANALYSIS OSes generate log files containing error information Failure of an application can generate core dump file capturing memory of the process Operating system failure can generate crash dump file containing kernel memory

FAILURE ANALYSIS Beyond crashes, performance tuning can optimize system performance Sometimes using trace listings of activities, recorded for analysis Profiling is periodic sampling of instruction pointer to look for statistical trends 10. 3

KERNIGHAN S LAW Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it Kernighan s Law 10. 4

PERFORMANCE TUNING Improve performance by removing bottlenecks OS must provide means of computing and displaying measures of system behavior 10. 56

WINDOWS TASK MANAGER

DTRACE DTrace tool in Solaris, FreeBSD, Mac OS X allows live instrumentation on production systems Probes fire when code is executed within a provider, capturing state data and sending it to consumers of those probes 10. 78

DTRACE Composed of compiler a framework providers of probes (written in framework) consumers of these probes Only users with DTrace priveledges are allowed to use DTrace

DTRACE 10. 9

DTRACE

DTRACE 10. 10 11

OPERATING-SYSTEM GENERATION 10 11. 12. 1

OPERATING-SYSTEM GENERATION Operating systems are designed to run on any of a class of machines; the system must be configured for each specific computer site 11. 2

OPERATING-SYSTEM GENERATION System Generation (SYSGEN) program obtains information concerning the specific configuration of the hardware system Used to build system-specific compiled kernel or systemtuned Can general more efficient code than one general kernel

OPERATING-SYSTEM GENERATION The kinds of information that must be determined CPU is used? What options (extended instruction sets, floating-point arithmetic, etc.) are installed? Partitions on disk Boot partition formatting How much memory is available What devices are available 11. 3

SYSTEM BOOT 11 12. 41

SYSTEM BOOT Bootstrap program or bootstrap loader locates the kernel I.e. the instruction register is loaded with a predefined memory location, and execution starts there. This program is in the form of read-only memory (ROM), because the RAM is in an unknown state at system startup.

BOOTSTRAP CODE Changing the bootstrap code requires changing the ROM hardware chips. Some systems resolve this problem by using erasable programmable read-only memory (EPROM), which is readonly except when explicitly given a command to become writable. 12. 2

FIRMWARE All forms of ROM are known as firmware, since their characteristics fall between hardware and software. A disk that has a boot partition is called a boot disk or system disk. 12. 34

EPROM http://thenextweb.com/insider/2016/02/01/running-asingle-delete-command-can-permanently-brick-laptopsfrom-inside-linux/ github issue and discussion 12. 5

QUESTIONS 13. 1

BONUS Exam question number 1: Operating-System Structures 13. 2