Outline - PowerPoint PPT Presentation

About This Presentation
Title:

Outline

Description:

Multiprocessor systems with more than one CPU in close communication. ... Note: malloc and free are library functions using memory management system calls ... – PowerPoint PPT presentation

Number of Views:16
Avg rating:3.0/5.0
Slides: 64
Provided by: xiuwe
Learn more at: http://www.cs.fsu.edu
Category:

less

Transcript and Presenter's Notes

Title: Outline


1
Outline
  • Introduction to Operating Systems
  • Using the Operating Systems
  • The abstract model of computing
  • System calls

2
System Overview
  • A computer system consists of hardware and
    software that are combined to provide a tool to
    solve specific problems
  • Hardware includes CPU, memory, disks, printers,
    screen, keyboard, mouse ...
  • Software includes
  • System software
  • A general environment to create specific
    applications
  • Application software
  • A tool to solve a specific problem

3
System Overview cont.
4
Hardware Resources
  • Processor execute instructions
  • Memory store programs and data
  • Input/output (I/O)controllers transfer to and
    from devices
  • Disk devices long-term storage
  • Other devices conversion between internal and
    external data representations

5
Hardware Resources cont.
6
Hardware Interface cont.
  • Everything that a programmer needs to know in
    order to write programs that perform desired
    operation on the hardware
  • Disk drive is an example
  • Disk interface provides functions to move disk
    head, transfer data
  • Monitor
  • Monitor interface provides functions to move the
    cursor, display characters/graphics

7
Software Classification
  • System software
  • Provides a general programming environment in
    which programmers can create specific
    applications
  • Application software
  • Intended to solve a specific problem

8
Software Classification - continued
9
What is an Operating System?
  • The operating system is the part of the system
    software that manages the use of the hardware
    used by other system software and all application
    software
  • It is the system program that acts between the
    hardware and the user programs

10
What is an Operating System? - continued
  • It provides services to user programs
  • Through system calls / message passing
  • File system services
  • Memory services
  • I/O services
  • It hides hardware from user programs
  • When your program shows a message on the monitor,
    it does not need to know the details
  • When your program generates a new file, it does
    not need to know where the free space is on your
    hard drive

11
Differences between OS and System Software
  • Major differences between OS and general system
    software
  • OS abstracts the hardware directly
  • General system software relies on the
    abstractions provided by OS
  • OS provides the fundamental trusted mechanisms
    for resource sharing
  • A general purpose OS is domain-independent

12
Operating System Functions
  • Resource manager
  • manage hardware and software resources
  • Resource abstraction and sharing
  • A nicer environment
  • implement a virtual machine for processes to run
    in
  • A program in execution is called a process
  • a nicer environment than the bare hardware

13
Resource Management Functions
  • Transform physical resources to logical resources
  • Resource abstraction
  • Make the hardware resources easier to use
  • Multiplex one physical resource to several
    logical resources
  • Create multiple, logical copies of resources
  • Schedule physical and logical resources
  • Decide who gets to use the resources

14
Resource Abstraction
  • Provides an abstract model of the operation of
    hardware components
  • Like data abstraction in Object-Oriented
    programming
  • Interface functions
  • Internal functions and status

15
A Disk Device Abstraction
  • Three interface functions
  • Load(block, length, device)
  • seek(device, track)
  • out(device, sector)

16
A Disk Device Abstraction cont.
  • An abstract function for writing

17
Resource Abstraction cont.
  • Multi-level abstractions
  • Disk controller -gt disk driver -gt file system

18
Resource Sharing
  • Two types of sharing
  • Time multiplexed sharing
  • time-sharing
  • schedule a serially-reusable resource among
    several users
  • Space multiplexed sharing
  • space-sharing
  • divide a multiple-use resource up among several
    users

19
Time-multiplexing the Processor
- Called multiprogramming
20
Time-multiplexing the Processor cont.
- Resulted in concurrent execution or concurrency
21
Time-multiplexing the Processor cont.
- Multiprogramming can improve the overall system
performance
22
Space-multiplexing Memory
23
Time-multiplexing I/O Devices
24
Space-multiplexing the Disk
25
Issues in Resource Sharing
  • Resource isolation and sharing
  • Protection
  • Sharing
  • Resource allocation
  • Scheduling

26
Do We Need an OS?
  • Not always
  • When resource abstraction or sharing is not
    needed
  • Some programs run stand-alone
  • Early computers did not have a sophisticated OS
  • OS was evolved along the hardware technology
  • But they are very useful
  • Reusable functions
  • Easier to use than the bare hardware

27
Operating Systems Strategies
  • Several different strategies have been used
  • Earliest computers were dedicated to a single
    program and there was no multiprogramming and no
    OS
  • Batch systems
  • Timesharing systems
  • There are a few other recent strategies
  • Personal computers and workstations
  • Embedded systems
  • Small, communicating computers
  • Network technology

28
Batch Processing Systems
  • Reduce setup time by batching similar jobs
  • Automatic job sequencing automatically
    transfers control from one job to another. First
    rudimentary operating system.
  • Resident monitor
  • initial control in monitor
  • control transfers to job
  • when job completes control transfers back to
    monitor

29
Batch Processing Systems - continued
30
Memory Layout for a Simple Batch System
31
Spooling
  • Overlap I/O of one job with computation of
    another job. While executing one job, the OS
  • Reads next job from card reader into a storage
    area on the disk (job queue).
  • Outputs printout of previous job from disk to
    printer.
  • Job pool data structure that allows the OS to
    select which job to run next in order to increase
    CPU utilization

32
Multi-programmed Batch Systems
Several jobs are kept in main memory at the same
time, and the CPU is multiplexed among them.
33
OS Features for Multi-programming
  • I/O routine supplied by the system
  • Memory management the system must allocate the
    memory to several jobs
  • CPU scheduling the system must choose among
    several jobs ready to run
  • Allocation of devices

34
Time-sharing Systems
  • The goal is to enable users to interact with the
    computer system
  • Batch processing systems do not allow user
    interactions
  • On-line communication between the user and the
    system is provided
  • When the operating system finishes the execution
    of one command, it seeks the next control
    statement not from a card reader, but rather
    from the users keyboard.
  • On-line system must be available for users to
    access data and code.

35
Time-sharing Systems - continued
36
Personal-computer Systems
  • Personal computers computer system dedicated to
    a single user.
  • I/O devices keyboards, mice, display screens,
    small printers.
  • User convenience and responsiveness.
  • Can adopt technology developed for larger
    operating system
  • often individuals have sole use of computer and
    do not need advanced CPU utilization of
    protection features.

37
Personal-computer Systems - continued
38
Embedded Systems
  • Often used as a control device in a dedicated
    application such as controlling scientific
    experiments, medical imaging systems, industrial
    control systems, and some display systems.
  • Well-defined fixed-time constraints.
  • Hard real-time system.
  • Secondary storage limited or absent, data stored
    in short-term memory, or read-only memory (ROM)
  • Conflicts with time-sharing systems, not
    supported by general-purpose operating systems.
  • Soft real-time system
  • Limited utility in industrial control or robotics
  • Useful in applications (multimedia, virtual
    reality) requiring advanced operating-system
    features.

39
Parallel systems
  • Multiprocessor systems with more than one CPU in
    close communication.
  • Tightly coupled system processors share memory
    and a clock communication usually takes place
    through the shared memory.
  • Advantages of parallel system
  • Increased throughput
  • Economical
  • Increased reliability
  • graceful degradation
  • fail-soft systems

40
Distributed Systems
  • Distribute the computation among several physical
    processors
  • Loosely coupled system each processor has its
    own local memory processors communicate with one
    another through various communications lines,
    such as high-speed buses or telephone lines
  • Advantages of distributed systems
  • Resources Sharing
  • Computation speed up load sharing
  • Reliability
  • Communications

41
Distributed systems - cont.
  • Network operating system
  • provides file sharing
  • provides communication scheme
  • runs independently from other computers on the
    network
  • Distributed operating system
  • less autonomy between computers
  • gives the impression there is a single operating
    system controlling the network.

42
Migration of Operating-System Concepts and
Features
43
Genesis of Modern OS
44
Using the O.S.
  • For a programmer, the operating system interface
    is most important
  • The functions provided by the OS
  • Abstract resources that are available

45
Requesting Services from O.S.
  • Two techniques
  • System call
  • Message passing

46
Requesting Services cont.
  • Two techniques
  • System call
  • Message passing

47
System Call Interface
  • System call interface
  • Operating system provides a set of operations
    called system calls
  • A programming interface

48
How to Make a System Call
  • For a programmer
  • A system call is similar to a procedure/function
    call in a traditional programming language
  • System calls are available in C/C as library
    routines
  • For example, fork to create a new process

49
How to Make a System Call cont.
  • pid fork()
  • if (pid ((pid_t)-1))
  • // Something must be wrong with the fork
  • // error processing
  • .........
  • else
  • if (pid 0)
  • // This is the child process
  • ........
  • else
  • // This is the parent process
  • .........
  • //How about here, the parent or the child ?
  • ...........

50
System Call Overview
  • man s 2 intro
  • List of all the system calls available
  • Process management system calls
  • Memory management system calls
  • File and I/O system calls
  • Communication system calls
  • Information maintenance system calls

51
Process Management System Calls
  • fork Create a new process
  • exit Terminate a process
  • wait Wait for a child process to terminate
  • exec Execute a file
  • nice Change scheduling priority for a process
  • _lwp_create Create a new lightweight process
  • yield Yield execution to another lightweight
    process

52
Thread Related Functions and System Calls
  • POSIX Thread
  • pthread_create
  • pthread_join
  • pthread_exit
  • Solaris Thread
  • thr_create
  • thr_join
  • thr_exit

53
Memory Management System Calls
  • brk Change the size of data segment of process
  • memcntl Memory management control
  • mmap Map pages of memory
  • (Memory mapped I/O)
  • Note malloc and free are library functions using
    memory management system calls

54
File Management System Calls
  • open Open a file for reading or writing
  • creat Create a new file and open it
  • read Read bytes from an open file
  • write Write bytes to an open file
  • close Close an open file
  • seek Change the location in the open file of
    the next read or write
  • stat Get information about a file
  • mkdir Make a directory
  • mount Mount a file system

55
File Management System Calls
  • open Open a file for reading or writing
  • creat Create a new file and open it
  • read Read bytes from an open file
  • write Write bytes to an open file
  • close Close an open file
  • seek Change the location in the open file of
    the next read or write
  • stat Get information about a file
  • mkdir Make a directory
  • mount Mount a file system

An open file is a dynamic object that can provide
bytes from a file or accept bytes to be stored in
the file. It has a set attributes, such as file
pointer. It is a virtual device created by the
operating system. Files however are passive
containers of data
56
I/O System Calls
  • open Open a device for reading or writing
  • read Read bytes from an open device
  • write Write bytes to an open device
  • close Close an open device
  • ioctl Control device

57
Communication System Calls
  • pipe Create an inter-process channel
  • kill Send a signal to a process or a group of
    processes
  • msgctl Message control operations
  • shmat, shmctl, shmget, shmop Shared memory
    operations
  • Semctl, semget, semop Semaphore operations

58
Information Maintenance System Calls
  • acct Enable or disable process accounting
  • stime Set system time and date
  • times Get process and child process times
  • utimes Set file times

59
Interactive and Programming Interfaces
  • Interactive interfaces have advantages
  • for exploration
  • for interactive use
  • Programming interfaces have advantages
  • for detailed interactions
  • Inter-application programming
  • Scripting
  • It is useful for a program to have both interfaces

60
Examples
  • Shell
  • Interactive interface to OS
  • System calls
  • Programming interface to OS

61
Shell as an Interactive Interface
  • Interactive access to the OS system calls and
    system and user programs
  • cd to change current working directory
  • System call is chdir
  • Started by the system for a user
  • Contains a simple programming language
  • Popularized by UNIX
  • Bourne shell, C shell (csh), Korn shell (ksh),
    Bourne-again shell (bash), etc.

62
Two views of a shell
63
Summary
  • Operating system is the system software that
    controls the basic operation of a computer
  • The layer between the hardware and the user
    programs
  • Resource manager manage hardware and software
    resources
  • Goals of operating systems
  • Convenience for users by providing a wide range
    of functions
  • Efficient operation of the computer system
  • Operating system provides services to user
    programs through system calls
  • Shell as an interactive interface to system calls
    and system and user programs
Write a Comment
User Comments (0)
About PowerShow.com