Download - Chapter 5 System Softwares
Computer Science/Ch. 5 System Softwares5-1
Chapter 5Chapter 5
System SoftwaresSystem Softwares
Computer Science/Ch. 5 System Softwares5-2
IntroductionIntroduction
• User interface:
• Virtual machine:
Hardware
Computer Science/Ch. 5 System Softwares5-3
System softwaresSystem softwares
• System softwares:– A collection of computer programs that manage the resource
s of a computer and facilitate access to those resources
Hardware
System softwares
User
Actual machine interface
Virtual machine interface
Virtualmachine
Computer Science/Ch. 5 System Softwares5-4
System softwaresSystem softwares
• Role of System softwares:– Hide from user details of the internal structure of machine
– Present important information in a way that is easy to understand
– Allow the user to access computing resources in a simple and efficient way
– Provide a secure and safe environment in which to operate
• Types of system softwares:
Operating systems
Language translator
Memorymanagers
Info.managers
Scheduler
utilit
y
ass
em
ble
r
co
mp
iler
s load
er
s link
er
s file s
yste
ms
da
taba
se
sys
tem
s
text
ed
itor
...
Computer Science/Ch. 5 System Softwares5-5
Types of system softwareTypes of system software
• Language translator:– assembler
– compiler
• Memory managers:– allocate memory space for programs and date and load
programs into memory prior to execution
• File system:– handle the storage and retrieval of information on mas
s storage devices such as disks, CD-ROMs, and tapes
• Scheduler:– Keeps a list of programs ready to run on the processor
and selects the one that will execute next
• Utilities:– library routines that provide useful services to either a
user or other system routines
– text editor
– debugging tools
Computer Science/Ch. 5 System Softwares5-6
Assembler and assembly Assembler and assembly languagelanguage
• Machine language:– use binary
– allow only numeric memory addresses
– difficult to change
– difficult to create data
• Assembly language:
assemblylanguageprogram
assemblermachinelanguageprogram
Loader
loaded intomemory
Hardwareresults
Computer Science/Ch. 5 System Softwares5-7
Assembly languageAssembly language
• Advantages of using assembly language:– Use of symbolic operation codes rather than numeric ones
– Use of symbolic names rather than numeric memory addresses
– Pseudo-operations that provide useful user-oriented services such as data generation
• Sample assembly language:– format:
• Example:
jump loop
.
.
.
loop: load X
• Data generation:
five: data 5
negseven: data -7
lable: op-code mnemonic address field
Computer Science/Ch. 5 System Softwares5-8
Assembly languageAssembly language
• Sample assembly language instruction set:
op-code mnemonic meaning
0000 load X con(X) -> R0001 store X R -> con(X)0010 clear X 0 -> con(X)0011 add X R + con(X) -> R0100 increment X con(X) + 1 -> con(X)0101 subtract X R - con(X) -> R0110 decrement X con(X) - 1 -> con(X)0111 compare X if con(X) > R then GT= ON if con(X) = R then EQ = ON if con(X) < R then LT = ON1000 jump X transfer to location X1001 jumpgt X transfer to location X if GT = ON1010 jumpeq X transfer to location X if EQ = ON1011 jumplt X transfer to location X if LT = ON1100 jumpneq X transfer to location X if EQ=OFF1101 in X input an integer from standard input device and store in location X1110 out X output the value in location X1111 halt stop program execution
Computer Science/Ch. 5 System Softwares5-9
ExampleExample
load B
add C
subtract SEVEN
store A
.
.
.
A: data 0
B: data 0
C: data 0
SEVEN:data 7
• Exercise:– write an assmbly program to compute the sum of
1+3+5+...+99
Computer Science/Ch. 5 System Softwares5-10
AssemblerAssembler
• Assembler's jobs:– convert symbolic op codes to binary
– convert symbolic addresses to binary
– put the translated instructions into a file for future use
• Two-pass assembler:– first pass:
» symbol table
– second pass:
» translate source program into machine language
Computer Science/Ch. 5 System Softwares5-11
Operating systemOperating system
Hardware
Operating system
user user
storageInput-Output
Computer Science/Ch. 5 System Softwares5-12
Operating systemOperating system
• Functions of OS:– user interface
– program scheduling and activation
– system and file access control
– efficient resource allocation
– deadlock detectionand error detection
• deadlock:– Example:
» Program A Program B
» get tape driver get laser printer
» get laser printer get tape driver
» print the file print the file
– deadlock prevention
» if a program cannot get all resources it needs, it must give up all resources it currently owns and issue a completely new request
– deadlock recovery
Computer Science/Ch. 5 System Softwares5-13
Events in executionEvents in execution
User
User Usercommand center
Scheduler
Resource allocator
Dispatcher
Hardware Execution
Computer Science/Ch. 5 System Softwares5-14
Time sharingTime sharing
• Multiuser systems
User
User
User
User
Machine
A B C A B C
time cycle
Computer Science/Ch. 5 System Softwares5-15
SchedulingScheduling
• CPU burst time:– Actual CPU time for a job in its time period
• Scheduling algorithms– First-In-FIrst-Out (FIFO): FCFS
– Shortest Job First (SJF)
– Round Robin (RR)
• Classes of scheduling algorithms:– Nonpreemptive
» do nor allow a job to be stopped once its CPU burst starts
– Preemptive