0% found this document useful (0 votes)
10 views48 pages

Chapter01 Introduction

hi

Uploaded by

yoyoweiguan1790
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views48 pages

Chapter01 Introduction

hi

Uploaded by

yoyoweiguan1790
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 48

© PSB Academy. All rights reserved.

All rights herein belong to PSB Academy and are protected by


copyright laws. Reproduction and distribution without permission is
prohibited.

Unless prior approval is obtained from lecturers, students are not allowed
to record (audio or video) lessons. Students are allowed to download and
use lesson materials from PSB Academy (including lecture recordings and
presentation slides) only for their personal revision. Different policies may
apply for lesson materials by our academic and industry partners - please
check with your School for more information.
Modern Operating Systems
Fourth Edition

Chapter 1
Introduction

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Components of a Modern Computer (1 of 2)
• One or more processors
• Main memory
• Disks
• Printers
• Keyboard
• Mouse
• Display
• Network interfaces
• I/O devices

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Components of a Modern Computer (2 of 2)

Figure 1-1. Where the operating system fits in.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


The Operating System as an Extended
Machine

Figure 1-2. Operating systems turn ugly hardware into beautiful abstractions.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


The Operating System as a Resource
Manager
• Top down view
– Provide abstractions to application programs
• Bottom up view
– Manage pieces of complex system
• Alternative view
– Provide orderly, controlled allocation of resources

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


History of Operating Systems
• The first generation (1945-55) vacuum tubes
• The second generation (1955-65) transistors and batch
systems
• The third generation (1965-1980) ICs and
multiprogramming
• The fourth generation (1980-present) personal computers
• The fifth generation (1990-present) mobile computers

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Transistors and Batch Systems (1 of 3)

Figure 1-3. An early batch system. (a) Programmers bring cards to 1401. (b) 1401 reads
batch of jobs onto tape.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Transistors and Batch Systems (2 of 3)

Figure 1-3. An early batch system. (c) Operator carries input tape to 7094. (d)7094 does
computing. (e) Operator carries output tape to 1401. (f) 1401 prints output.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Transistors and Batch Systems (3 of 3)

Figure 1-4. Structure of a typical F MS job.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


ICs and Multiprogramming

Figure 1-5. A multiprogramming system with three jobs in memory.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Processors (1 of 2)

Figure 1-6. Some of the components of a simple personal computer.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Processors (2 of 2)

Figure 1-7. (a) A three-stage pipeline. (b) A superscalar C PU.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Memory (1 of 3)

Figure 1-8. (a) A quad-core chip with a shared L2 cache. (b) A quad-core chip with
separate L2 caches.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Memory (2 of 3)

Figure 1-9. A typical memory hierarchy. The numbers are very rough approximations.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Memory (3 of 3)
Caching system issues:
1. When to put a new item into the cache.
2. Which cache line to put the new item in.
3. Which item to remove from the cache when a slot is
needed.
4. Where to put a newly evicted item in the larger
memory.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Disks

Figure 1-10. Structure of a disk drive.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


I/O Devices (1 of 2)

Figure 1-11. (a) The steps in starting an I/O device and getting an interrupt.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


I/O Devices (2 of 2)

Figure 1-11. (b) Interrupt processing involves taking the interrupt, running the interrupt
handler, and returning to the user program.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Buses

Figure 1-12. The structure of a large x86 system

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


The Operating System Zoo
• Mainframe Operating Systems
• Server Operating Systems
• Multiprocessor Operating Systems
• Personal Computer Operating Systems
• Handheld Computer Operating Systems
• Embedded Operating Systems
• Sensor Node Operating Systems
• Real-Time Operating Systems
• Smart Card Operating Systems

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Processes (1 of 2)
• Key concept in all operating systems
• Definition: a program in execution
• Process is associated with an address space
• Also associated with set of resources
• Process can be thought of as a container
– Holds all information needed to run program

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Processes (2 of 2)

Figure 1-13. A process tree. Process A created two child processes, B and C. Process B
created three child processes, D, E, and F.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Files (1 of 3)

Figure 1-14. A file system for a university department.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Files (2 of 3)

Figure 1-15. (a) Before mounting, the files on the C D-ROM are not accessible. (b) After
mounting, they are part of the file hierarchy.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Files (3 of 3)

Figure 1-16. Two processes connected by a pipe.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Ontogeny Recapitulates Phylogeny
• Each new “species” of computer
– Goes through same development as “ancestors”
• Consequence of impermanence
– Text often looks at “obsolete” concepts
– Changes in technology may bring them back
• Happens with large memory, protection hardware, disks,
virtual memory

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


System Calls (1 of 5)

Figure 1-17. The 11 steps in making the system call read(fd, buffer, nbytes).

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


System Calls (2 of 5)
Some of the major POSIX system calls. The return code s is −1 if an error has
occurred. The return codes are as follows: pid is a process id, fd is a file
descriptor, n is a byte count, position is an offset within the file, and seconds
is the elapsed time.

Process Management
Call Description
pid fork( ) Create a child process identical
to the parent
pid waitpid( pid, Wait for a child to terminate
&statloc, options)
s execve(name, argv, Replace a process' core image
environp)
exit(status) Terminate process execution
and return status

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


System Calls for Process Management

Figure 1-19. A stripped-down shell. Throughout this book, TRUE is assumed to be defined as 1.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


System Calls (3 of 5)
Some of the major POSIX system calls. The return code s is −1 if an error has
occurred. The return codes are as follows: pid is a process id, fd is a file
descriptor, n is a byte count, position is an offset within the file, and seconds
is the elapsed time.

File Management
Call Description
fd open(file, how, ...) Open a file for reading, writing, or both
s = close(fd) Close an open file
n = read(fd, buffer, nbytes) Read data from a file into a buffer
n = write(fd, buffer, nbytes) Write data from a buffer into a file
Position = Iseek(fd, offset, Move the file pointer
whence)
s = stat(name, &buf) Get a file's status information

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


System Calls (4 of 5)
Some of the major P O SIX system calls. The return code s is −1 if an
error has occurred. The return codes are as follows: pid is a process
id, fd is a file descriptor, n is a byte count, position is an offset within
the file, and seconds is the elapsed time.
Directory and file system management
Call Description
s = mkdir(name, mode) Open a file for reading, writing, or both
s= rmdir(name) Close an open file
s= link(name1 , name2) Read data from a file into a buffer
s= unlink(name) Write data from a buffer into a file
s= mount(special, name, flag) Move the file pointer
s= umount(special) Get a file's status information

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


System Calls (5 of 5)
Some of the major POSIX system calls. The return code s
is −1 if an error has occurred. The return codes are as
follows: pid is a process id, fd is a file descriptor, n is a
byte count, position is an offset within the file, and
seconds is the elapsed time.
Miscellaneous
Call Description
s = chdir(dirname) Change the working directory
s= chmod(name,mode) Change a file's protection bits
s= kill(pid,signal) Send a signal to a process
s= time(&seconds) Get the elapsed time since Jan. 1, 1970

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


System Calls for File Management

Figure 1-20. Processes have three segments: text, data, and stacks

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


System Calls for Directory Management (1 of
2)

Figure 1-21. (a) Two directories before linking usr/jim/memo to ast’s directory. (b) The
same directories after linking.s

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


System Calls for Directory Management (2 of
2)

Figure 1-22. (a) File system before the mount. (b) File system after the mount.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


The Windows Win32 API (1 of 2)
The Win32 API calls that roughly correspond to the UNIX
calls of Fig. 1-18.
UNIX Win32 Description
fork CreateProcess Create a new process
waitpid WaitForSingIeObject Can wait for a process to exit
execve (none) Createprocess fork + execve
exit ExitProcess Terminate execution
open createFile Create a file or open an existing file
close CloseHandIe Close a file
read ReadFile Read data from a tile
Write WriteFile Write data to a file
I seek SetFilePointer Move the file pointer
stat GetFileAttributesEx Get various file attributes
mkdir CreateDirectory Create a new directory

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


The Windows Win32 API (2 of 2)
The Win32 API calls that roughly correspond to the UNIX
calls of Fig. 1-18.
Iseek SetFilePointer Move the tile pointer
stat GetFileAttributesEx Get various file attributes
mkdir CreateDirectory Remove an empty directory
rmdjr RemoveDjrectory Create a new directory
link (none) Win32 does not support links
unlink DeleteFile Win32 does not support mount
mount (none) Win32 does not support mount
umount (none) Destroy an existing file
chdir SetCurrentDirectory Change the current working directory
chmod (none) Win32 does not support security
(although NT does)
kill (none) Win32 does not support signals
time GetLocamme Get the current time

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Monolithic Systems (1 of 2)
Basic structure of OS
1. A main program that invokes the requested service
procedure.
2. A set of service procedures that carry out the system
calls.
3. A set of utility procedures that help the service
procedures.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Monolithic Systems (2 of 2)

Figure 1-24. A simple structuring model for a monolithic system.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Layered Systems
Structure of the THE operating system.

Layer Function
5 The operator
4 User programs
3 Input/output management
2 Operator-process communication
1 Memory and drum management
0 Processor allocation and
multiprogramming

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Microkernels

Figure 1-26. Simplified structure of the M INIX 3 system.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Client-Server Model

Figure 1-27. The client-server model over a network.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Virtual Machines

Figure 1-28. The structure of V M/370 with CMS.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Virtual Machines Rediscovered

Figure 1-29. (a) A type 1 hypervisor. (b) A pure type 2 hypervisor. (c) A practical type 2
hypervisor.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Large Programming Projects

Figure 1-30. The process of compiling C and header files to make an executable.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Metric Units

Figure 1-31. The principal metric prefixes.

Copyright © 2014 Pearson Education, Inc. All Rights Reserved


Copyright

Copyright © 2014 Pearson Education, Inc. All Rights Reserved

You might also like