View
214
Download
0
Category
Tags:
Preview:
Citation preview
Welcome to CMPE003 Personal
Computers: Hardware and
SoftwareDr. Chane FullmerDr. Chane Fullmer
Fall 2002Fall 2002
UC Santa CruzUC Santa Cruz
September 27, 2002 2
Assignments
Details on the class web page: http://www.soe.ucsc.edu/classes/cmpe003/Fall02/
TAs Dyng Au Dat Nguyen
Sections Monday – 9 -11AM, SS 1 #135 Tuesday/Thursday – 11 – 12PM, JBE #109 Friday – 9 – 11AM, JBE #109
September 27, 2002 3
1st HomeworkDue Today by 11:59PM
NOTE: This homework must be completed successfully to
continue in this class If this homework is not received by the due date,
you will be dropped from the class No adds will be allowed after this due date
-- no exceptions
Due Today……Must be turned in TODAY by 11:59 PM
September 27, 2002 4
2nd HomeworkDue October 4, 2002
Web Search Exercise See class web page for details http://www.soe.ucsc.edu/classes/cmpe003/Fall02/
September 27, 2002 5
Midterm #1
Friday – October 11 Chapters 1 – 5 ~50 questions Multiple choice
Bring scantron number F-1712-ERI-L (big & pink) Bring your student ID
Required to take exam
September 27, 2002 7
Objectives of Chapter 2 Describe the functions of an Operating System Explain the basics of a personal computer operating system Describe the advantages of a graphical operating system Differentiate among different operating systems Explain the need for network operating systems
Describe the methods of resource allocation on large computers Be able to describe the differences among multiprocessing, multiprogramming, and timesharing Explain the principles of memory management List several functions typically performed by utility programs
September 27, 2002 8
Operating SystemHidden Software
Definition – provides access to all resources Kernel
Manages the operating system Memory resident Loads set of programs that lies between applications
software and the hardware Fundamental software that controls non-resident portions of
the OS as needed Booting – Loads the kernel into memory
September 27, 2002 9
Functions of OS Manage the computer’s resources
CPU Memory Disk drives Printers
Establish a user interface
Executes and provides services for applications software
Carries out all input and output operations
September 27, 2002 10
What is an OS?
Machine/resource manager.
Physical Devices
MicroarchitectureInstruction Set Architecture
Operating System
Utilities, Editors, etc.
Hardware
Application programs
September 27, 2002 11
Large Computer OSs
Used by many people at once OS works “behind the scenes” so users
can share resources OS must control
Who gets access to resources What keeps the programs from different users
from getting mixed up with one another
September 27, 2002 12
Resource Allocation
Resource – hardware or software that is needed to complete a task
Resource Allocation – assigning computer resources to certain programs
Resource De-allocation – releasing resources when a task is complete
September 27, 2002 13
Deadlocks
Shared data/resource may lead to deadlock: processes get “stuck”.
Example: v is using r1 and requests r2; w is using r2 and requests r1.
wv
r1 r2
September 27, 2002 14
Allocating the CPU
One CPU Multiprogramming (aka Multitasking)
Event-driven Timesharing
More than one CPU Multiprocessing – multiple CPUs can run
several programs simultaneously SMP – Symmetrical Multi-Processing
September 27, 2002 15
Multiprogramming
One CPU Concurrent execution of two or more
processes Several processes open at once Only one process can receive the attention of
the CPU at any given moment Effective because CPU speeds are many
times faster than input/output speeds
September 27, 2002 16
Event-driven Multiprogramming
One program receives the attention of the CPU
Its processing will be interrupted based upon events in the program
When processing needs to be temporarily suspended, an interrupt is generated
This is a signal to the operating system to evaluate the cause of the interrupt and determine who should now have CPU time
September 27, 2002 17
Event-driven Multiprogramming Example
Two programs are running – Payroll and Inventory Management
Payroll needs to read an employee record
Payroll generates an interrupt to read from the disk
Normal processing is temporarily suspended
The CPU looks at the interrupt and initiates the read operation on the disk drive
While waiting for the read to complete, the CPU begins processing the Inventory Management program
September 27, 2002 18
Event-driven Multiprogramming Example
When the disk read operation is complete, another interrupt is generated
Normal processing is temporarily suspended
The CPU looks at the interrupt and determines its cause (read the data in from the disk drive for the Payroll program)
The CPU will either continue processing the Inventory Management program or return to the Payroll program depending upon their priority
September 27, 2002 19
Time-sharing Multiprogramming
One program receives the attention of the CPU
A small fraction of CPU time is allocated to the program
The time slice ends
The CPU begins processing a different program
Response time can vary based upon the number of users on the system
September 27, 2002 20
Sharing Memory
Program must be in memory to be executed
Problems Programs compete for space May have a very large program Memory space for each program must not
overlap
September 27, 2002 21
Memory Management
The process of providing separate memory space to programs
Memory Protection keeps one program from interfering with another
September 27, 2002 22
Memory ManagementMethods
Partitions or regions
Foreground and background
Virtual storage (virtual memory)
September 27, 2002 23
Partitions or Regions
Divide memory into sections (ie, partitions)
The partition must accommodate the largest possible program
Problem May cause wasted memory space
September 27, 2002 24
Foreground and Background Programs are placed in either Foreground or
Background
Programs in Foreground have priority for CPU time
While performing read / write operations for the Foreground program, the CPU gives time to a program in Background
Programs are placed in a holding queue while waiting to run
September 27, 2002 25
Virtual StorageVirtual Memory
Uses concept of Paging
Divide the program into equal-size pieces (pages)
Store each piece in equal-size memory spaces (page frames)
Typical size is 2KB or 4KB
Create an index to each page and store in a Page Table
September 27, 2002 26
Paging Process
A portion of the program is placed in memory
The remainder is on disk
Sections on disk will be brought into memory as needed (one page at a time)
Virtual StorageVirtual Memory
September 27, 2002 27
Virtual StorageVirtual Memory
Problem -- Thrashing A large portion of CPU time is spent swapping the
correct page and bringing it into memory Solution
Run fewer programs concurrently Add memory Program design
“working set” size – number of pages required in memory for program to run
September 27, 2002 28
Memory Protection
Keeps one program from straying into another Confines each program to certain defined
limits in memory Why needed
Possible for one program to destroy or modify another by transferring to the wrong memory location
May cause destruction of data Action if assigned memory space is violated
Termination of executing program
September 27, 2002 29
Sharing Storage
Several users need to access the same disk pack One wants to write Another wants to read
OS keeps track of the I/O requests
OS processes I/O requests in order received
September 27, 2002 30
Sharing Printing Resources
Print resources are shared between active programs
Printouts are generated in pieces as the CPU gives each concurrent program some time
Problem The current program may generate a few print lines The CPU moves to the next program The second program may generate a few print lines,
etc.
September 27, 2002 31
Sharing Printing Resources
Result Printout is worthless as it contains a few lines
from several programs
Solution – Spooling Each program thinks it is writing to the printer The program actually writes to the hard disk When the program is complete, the file on the
hard disk is sent to the printer
September 27, 2002 32
Additional Printing Problem
Printers are slow compared to the CPU speed
Solution The CPU writing to the disk The program completes quicker
September 27, 2002 33
Utility Programs
Come with System Software Handle special needs Perform secondary chores Do not need to be memory resident
September 27, 2002 34
Functions of Utility programs File manager – provide access to lists of stored files Backup and Restore – make duplicate copies of
important files and return the copy to the hard drive if needed
File compression – reduces the amount of disk space required by a file
Disk defragmenter – reorganize files so they are stored contiguously on disk providing for faster access
Device drivers – convert operating system instructions into commands that are known to a specific device
September 27, 2002 35
Next Week….
Chapter 3 (Monday)“Applications Software: Getting the Work Done”
Chapter 4 (Wednesday/Friday)“The Central Processing unit: What Goes on
Inside the Computer”
Recommended