Академический Документы
Профессиональный Документы
Культура Документы
Unit 27
Course
an!"ook
Sanyaa!e O# $!ekoya
SECTION ONE What is an operating system? What are input and output devices? Where are operating systems found? What is a general purpose operating system? What is a program? Dedicated operating systems A simple operating system for a security system What are input output devices Exercises 1, 2, 3 What is a single-user operating system? What is a multi-user operating system? perating system utilities perating system interfaces Advantages and pro!lems of multi-user operating systems What is a multi-tas"ing operating system? What is soft#are and application soft#are? What are the general categories of application soft#are? $evision Exercise 1 SECTION T%O What are the various parts of an operating system? What is a real-time executive? What is a computer program? %o# does an operating system run more than one program at once? What is cooperative and preemptive scheduling? What is dispatching? What is system overhead? What is re&uired to s#itch from one program to another? What is context s#itching? What is scheduling? ther methods of scheduling $evision Exercise 2 SECTION T &EE What is a process? What a!out process states? What is a process control !loc"? %o# do processes intercommunicate? %o# do processes syncroni'e their activity? %o# do processes protect critical data? What is a thread? What is a !ac"ground and foreground tas"? $evision Exercise 3
SECTION 'O(& %o# does an operating system load? What is the !ootstrap process? What are the different types of operating systems? What is a shell? $evision Exercise ( SECTION 'I)E 'I*E +$N$,E+ENT What is a file? What typical operations are performed on files? What are file control !loc"s? What a!out ho# #e name files? What are file types? %o# does an operating system "eep trac" of files? What is a root file system? What does a root file system entry loo" li"e? What is a cluster? %o# is free space managed? What file systems are supported !y Windo#s operating systems? What are access control lists and file permissions? What is a sym!olic lin" or shortcut? What is file-system integrity? What is fragmentation and #hat does defragging a drive do? $evision Exercise ) SECTION SI- SO'T%$&E TOO*S Editors *he program translation se&uence Assem!lers %igh level languages +nterpreters ,ompilers -in"ers -oaders and locators ,ross reference Disassem!ers De!uggers and monitors ,ross assem!lers $evision Exercise . SECTION SE)EN Basic 'eatures of ,rap.ical Interfaces *he mouse *he mouse cursor /electing items #ith a mouse Windo# fundamentals Windo# properties 3
SECTION EI, T %in!ows O"/ects an! Components *ext 0oxes $adio 0uttons ,hec" 0oxes Dialog 0oxes -ist 0oxes Drop Do#n -ist 0oxes *a! ,ontrols *ool!ars SECTION NINE %ard#are re&uirements 1eneral 2eatures of Windo#s Easy +nstallation 1raphical +nterface 3lug and 3lay Add4$emove 3rograms 5et#or"ing
O0er0iew
*his module introduces you to the su!6ect of operating systems7 +t is an introductory course that #ill ta"e you approximately (8-(8 hours to complete 9including the exercises: depending upon your level of prior "no#ledge7
*earning Outcomes
At the end of this section you should !e a!le to
define #hat an operating system is list four functions performed !y an operating system !riefly explain the difference !et#een a general purpose operating system and a dedicated operating system classify soft#are according to either !usiness, operating system, utility, education or entertainment categories identify from a list #hich items are input or output devices explain the difference !et#een a single-user and a multi-user operating system classify common operating systems as either single-user or multi-user
initiali'e the hard#are of the computer system provide !asic routines for device control provide for the management, scheduling and interaction of tas"s maintain system integrity and handle errors
*here are many types of operating systems, the complexity of #hich varies depending upon #hat type of functions are provided, and #hat the system is !eing used for7 /ome systems are responsi!le for managing many users on a net#or"7 ther operating systems do not manage user programs at all7 *hese are typically found in hard#are devices li"e petrol pumps, airplanes, video recorders, #ashing machines and car engines7 *hese are often referred to as dedicated operating systems7
What is a program?
A program is a set of instructions that performs a tas"7 When #e tal" a!out programming a computer or #riting a computer program, #e mean #riting a set of instructions that the computer can execute7 Developers 9people #ho #rite programs: need to use special soft#are to #rite programs, often called compilers7
*he first tas" of this initiali'e program #ould !e to reset 9and pro!a!ly test: the hard#are sensors and alarms7 nce the hard#are initiali'ation #as complete, the operating system #ould enter a continual monitoring routine of all the input sensors7 +f the state of any input sensor changed, it #ould !ranch to an alarm generation routine7
Exercise 1
,lassify each of the follo#ing devices as an input or output device
Exercise 2
2or a simple home security system, ma"e a list of possi!le input and output devices that you thin" might !e re&uired7 Input De0ices Output De0ices
Exercise 3
*his is a 3hilips video recorder7 >a"e a list of possi!le input and output devices that you thin" the operating system inside this video recorder might !e re&uired to manage7 Input De0ices Output De0ices
<
*oday, these terminals are generally personal computers and use a net#or" to send and receive information to the multi-user computer system7 Examples of multi-user
operating systems are @5+A, -inux 9a @5+A clone: and mainframes such as the +0> A/(887
*he operating system for a large multi-user computer system #ith many terminals is much more complex than a single-user operating system7 +t must manage and run all user re&uests, ensuring they do not interfere #ith each other7 Devices that are serial in nature 9devices #hich can only !e used !y one user at a time, li"e printers and dis"s: must !e shared amongst all those re&uesting them 9so that all the output documents are not 6um!led up:7 +f each user tried to send their document to the printer at the same time, the end result #ould !e gar!age7 +nstead, documents are sent to a &ueue, and each document is printed in its entirety !efore the next document to !e printed is retrieved from the &ueue7 When you #ait inline at the cafeteria to !e served you are in a &ueue7 +magine that all the people in the &ueue are documents #aiting to !e printed and the cashier at the end of the &ueue is the printer7
>anaging 2iles and Documents Development of 3rograms and /oft#are ,ommunicating !et#een people and #ith other computer systems >anaging user re&uirements for programs, storage space and priority
18
other systems it might !e highly graphical using #indo#s and a pointing device such as a mouse 9such as A-Windo#s:7
11
E!ucation
Examples of education soft#are are Encylopedia 0ritannica and >icrosoft >agic /chool 0us7 Entertainment/,ames Entertainment soft#are is designed for you to have fun #ithD +ts purpose is to "eep you entertainedD *his includes games soft#are7 Examples of entertainment soft#are are >icrosoft Age of Empires and /im ,ity 28887 @tility soft#are is designed for you to perform routine tas"s associated #ith the storage and manipulation of your information7 *his includes soft#are such as schedulers, cloc"s, media players and communication tools7 Examples of utility soft#are are >cAfee Eirus /can and Arcada !ac"up soft#are7
(tility
$evision Exercise 1
-ist 2 @$ things an operating system does7
12
-ist *%$EE home appliance devices in your home that pro!a!ly have an operating system controlling their function7
-ist 2 @$ hard#are devices on a typical home computer that an operating system has to initiali'e #hen it is turned on7
-ist *%$EE possi!le errors that might occur in a typical home computer that an operating system has to handle7
/tate *%$EE possi!le !asic routines an operating system might provide for handling a hard#are device7
13
*earning Outcomes
At the end of this section you should !e a!le to
list four typical parts 9modules: of an operating system state three functions performed !y a real-time executive explain the difference !et#een pre-emptive and co-operative s#itching discuss the relationship !et#een system performance and system overhead identify the essential operations that need to !e performed in order to s#itch from one program to another define the terms context s#itching, system overhead, time-slice, &uantum period and scheduling distinguish !et#een first-in first-out and round ro!in scheduling
Fernel 9also "no#n as the real-time executive: 3rocess manager /cheduler 2ile manager
s#itching !et#een programs hard#are device control and programming memory management process management scheduling inter-process communication processing of exceptions and interrupts
ur simple security monitoring system #ould not have all of the a!ove, as it #ould pro!a!ly !e a single tas" system, running only one program7 As such, it #ould not need to perform scheduling of more than one program or allo# communication to
1(
ta"e place !et#een programs 9called inter-process communication:7 >emory management #ould !e unnecessary, as the program #ould easily fit into the availa!le memory of the computer7 An operating system designed to handle a large num!er of people #ould need a realtime executive that performs all of the a!ove7 @ser programs are generally stored on dis", thus need to !e loaded into memory !efore !eing executed7 *his presents the need for memory management, as the memory of the computer #ould need to !e searched for a free area in #hich to load a persons program into7 When the user #as finished running the program, the memory consumed !y it #ould need to !e freed up and made availa!le for another user #hen re&uired7 3rocess scheduling and management is also necessary, so that all programs #ould !e executed and run fairly7 *here is no point if a program !y a specific user runs to such an extent that it denies the running of any other programs, ma"ing every other user #ait7 +n addition, some programs might need to !e executed more fre&uently than others, for example, chec"ing net#or" communications or printing7 /ome programs may need to !e temporarily halted, then restarted again later, so this introduces the need for inter-program communication7
%.at is a processor1
3rocessors execute computer programs7 A processor is a chip in the computer that executes program instructions7 3rocessors execute millions of instructions per second7
to the next process and so on7 As the processor executes millions of instructions per second, this gives the appearance of many processes running at once7
,o-operative s#itching means that a tas" that is currently running #ill voluntarily give up the processor at some time, allo#ing other processes to run7 3reemptive s#itching means that a running tas" #ill !e interrupted 9forced to give up: and the processor given to another #aiting process7
*he pro!lem #ith co-operative s#itching is one process could hang and thus deny execution of other processes, resulting in no #or" !eing done7 An example of a cooperative system #as Windo#s 371 3re-emptive scheduling is !etter7 +t gives more response to all processes and helps prevent 9or reduce the num!er of occurrences of: the dreaded machine loc"up7 Windo#s 5* #or"station is an example of such as operating system7 Note2 nly 32-!it programs in Windo#s ;) are pre-emptive s#itched7 1.-!it programs are still co-operatively s#itched, #hich means it is still easy for a 1.-!it program to loc" up a Windo#s ;) computer7
A multi-user operating system allo#s more than one user to share the same computer system at the same time7 +t does this !y time-slicing the computer processor at regular intervals !et#een the various programs run !y each user7 +n this example, there are five people that share the processor hard#are and main memory on a time !asis7 ,onsider a (<. +ntel processor running at )8>%'7 *his processor is capa!le of a!out . million instructions per second7 +f #e decided that #e #ould share the hard#are !y letting each user run for 14)th of a second, this #ould mean each user could execute a!out 172 million instructions each time they have the processor7 We start off !y giving the first user 9#hich #e #ill call 0art: the processor hard#are, and run 0arts program for 14)th of a second7 When the time is up, #e intervene, save 1.
0arts program state 9program code and data: and then start running the second user program 9for 14)th of a second:7 *his process continues till #e eventually get !ac" to user 0art7 *o continue running 0artHs program, #e restore the programs code and data and then run for 14)th of a second7
What is dispatching?
+t #ill !e noted that it ta"es time to save4restore the programs state and s#itch from one program to another 9called !ispatc.ing:7 *his action is performed !y the "ernel, and must execute &uic"ly, !ecause #e #ant to spend most of our time running user programs, not s#itching !et#een them7
a regular timed interrupt event 9provided !y a cloc": saving the interrupted programs state and data restoring the next programs state and data running that program till the next timed interrupt occurs
*he timed event is usually a!out 1 to 18 milliseconds apart and generated !y a realtime cloc"7 *o save and restore program states re&uires hard#are support, a feature supported !y +ntel processors7
1?
#ill !e restarted and continue as though it #as never interrupted7 nce this state has !een saved, the next #aiting process is activated7 *his involves loading the processor registers and memory #ith all the previously saved data and restarting it at the instruction that #as to !e executed #hen it #as last interrupted7 *he process of s#itching from one process to another is called conte3t switc.ing7 A time period that a process runs for !efore !eing context s#itched is called a time slice or 4uantum perio!7
What is scheduling?
Deciding #hich process should run next is called sc.e!uling, and can !e done in a #ide variety of #ays7 ,o-operative schedulers are generally very simple, as the processes are arranged in a $ @5D $ 0+5 &ueue7 When a running process gives itself up, it goes to the end of the &ueue7 *he process at the top of the &ueue is then run, and all processes in the &ueue move up one place7 *his provides a measure of fairness, !ut does not prevent one process from monopoli'ing the system 9failing to give itself up:7 3re-emptive scheduling uses a real-time cloc" that generates interrupts at regular intervals 9say every 14188th of a second:7 Each time an interrupt occurs, the processor is s#itched to another tas"7 /ystems employing this type of scheduling generally assign priorities to each process, so that some may !e executed more fre&uently than others7 'irst in 'irst Out Sc.e!uling A 2+2 &ueue is a list of availa!le processes a#aiting execution !y the processor7 5e# processes arrive and are placed at the end of the &ueue7 *he process at the start of the &ueue is assigned the processor #hen it next !ecomes availa!le, and all other processes move up one slot in the &ueue7 &oun! &o"in Sc.e!uling ne of the pro!lems #ith the 2+2 approach is that a process may in fact ta"e a very long time to complete, and thus holds up other #aiting processes in the &ueue7 *o prevent this from happening, #e employ a pre-emptive scheduler that lets each process run for a little #hile7 When the time-slice is up, the running process is interrupted and placed at the rear of the &ueue7 *he next process at the top of the &ueue is then started7
1<
$evision Exercise 2
-ist 2+EE functions that a real time executive does7
What is co-operative s#itching and ho# does it differ from pre-emptive s#itching?
What is dispatching?
What happens to the performance of running user programs #hen system overhead increases?
What is a time-slice?
What is scheduling?
1;
What is one pro!lem #ith 2irst-+n-2irst- ut &ueues #hen used to schedule processes7
+dentify the follo#ing operating systems as either single user or multi-user, and as pre-emptive or co-operative perating /ystem /ingle or multi-user 3re-emptive or co-operative Windo#s ;< Windo#s A3 -inux
SECTION THREE
28
*earning Outcomes
At the end of this section you #ill !e a!le to
explain #hat a process is and ho# an operating system manages each process identfy the relationships !et#een the three process states list four items associated #ith a process control !loc" define the terms thread, process, critical section and semaphore illustrate ho# access to a shared resource can !e controlled using a semaphore discuss the pro!lems associated #ith critical sections explain the difference !et#een a foreground and a !ac"ground tas"
What is a 3rocess?
+n this section #e loo" at ho# the operating system manages the various programs or tas"s that need to !e run7 A process or tas" is a portion of a program in some stage of execution7 A program can consist of several tas"s, each #or"ing on their o#n or as a unit 9perhaps periodically communicating #ith each other:7 Each process that runs in an operating system is assigned a process control !loc" that holds information a!out the process, such as a uni&ue process +D 9a num!er used to identify the process:, the saved state of the process, the process priority and #here it is located in memory7 *he process priority is used to determine ho# often the process receives processor time7 *he operating system may run all processes #ith the same priority, or it may run some processes more often that others7 3rocesses that have !een #aiting a long time for execution !y the processor may have their priority increased so that they #ill !e more li"ely to !e executed in the future7
21
saved in the associated process control !loc"7 *he process state is changed to !loc"ed and the priority ad6usted7 When the scheduler decides the next tas" to run, it changes the process state of the selected process to running and loads the saved data associated #ith that process !ac" into the processor7 *ypically, an operating system #ill provide a num!er of program function calls that can !e used to control processes7 *hese are similar to those sho#n !elo#, !loc"9: #a"eup9: suspend9: sleep9: changeJpriority9:
the location in memory of #here the process is the priority of the process a uni&ue process identification num!er 9called 3+D: the current process state 9ready, running, !loc"ed: associated data for the process
22
What is a thread?
A thread is a separate part of a process7 A process can consist of several threads, each of #hich execute separately7 2or example, one thread could handle screen refresh and dra#ing, another thread printing, another thread the mouse and "ey!oard7 *his gives good response times for complex programs7 Windo#s 5* is an example of an operating system #hich supports multi-threading7
23
screen7 A !ac"ground tas" is one that runs in the !ac"ground 9it does not have access to the screen or "ey!oard:7 0ac"ground tas"s are usually used for printing7 Windo#s 5* Wor"station and Windo#s ;)4;< assign a higher priority to foreground tas"s7
$evision Exercise 3
What is a process?
What is a semaphore?
2(
What is a thread?
Why does operating systems such as Windo#s 5* and Windo#s ;< give a higher priority to the foreground tas" compared to that of !ac"ground tas"s7
SECTION FOUR
2)
*earning outcomes
At the end of this section you should !e a!le to
descri!e ho# an operating system is intially loaded given a set of characteristics, determine the type of operating system as !atch, real-time, ime-sharing, interactive or em!edded state an example of a shell
it is already present in $ > 9so is permanent, immediately accessi!le and difficult to update: it is loaded from dis" #hen the computer is turned on7
+f the operating system is already present in $ > 9for systems li"e industrial controllers, petrol pumps etc:, it #ill gain control immediately the processor is po#ered on7 *his method is !est suited for small appliances and hand held devices #here the operating system is relatively simple and small7 2or more complex systems, the operating system is usually stored on secondary media 9such as dis":, and is loaded into the computer memory 9$A>: #hen the computer is po#ered on7 Advantages of this type of system are that changes to the operating system are easier to ma"e and implement7
What is the 0
*/*$A3 3$ ,E//?
*he !ootstrap process descri!es the tas" of initially loading the operating system from dis" into $A>7 A small routine stored in $ >, called the 0 */*$A3 - ADE$ or +3- 9+nitial 3rogram -oader:, reads a special load routine from the dis"ette7
2.
+n floppy !ased system, this routine is normally located on *rac" 88, sector 88 9or 81:, and is called the "oot sector7 *he code contained in the sector is transferred into $A>, then executed7 +t has the sole responsi!ility for loading the rest of the operating system into memory7
INTE&5$CTI)E
+(*TI5T$S6IN,
&E$*5TI+E
2?
changing the computers model of the environment, thus affecting the outputs, #ithin a guaranteed time period 9usually K 1 second:7 +(*TI57&OCESSO& A computer that has more than one processor dedicated to running processes7 An em!edded operating system means the operating system is self-contained in the device and resident in $ >7 *ypical systems that use em!edded operating systems are household appliances, car management systems, traffic control systems and energy management systems7
E+BEDDED
Em!edded systems are also "no#n as !e!icate! systems7 *his is !ecause they only perform a specific tas", and cannot run a #ide variety of programs li"e a home computer 9#hich #e previously identified as a general purpose system:7 Windo#s 5* #or"station is an interactive, multitas"ing multiprocessor operating system7 Windo#s ;< is an interactive, multitas"ing operating system7 -inux is an interactive, multitas"ing, multiprocessor, multi-user operating system7
What is a shell?
A shell is a program that handles user input and output7 +t provides routines for handling user input from a "ey!oard or mouse, as #ell as routines for displaying information on the terminal screen7 A shell also provides a mechanism to interpret user commands and run additional programs that users re&uest7
2<
+n program called command7com #as the shell in >/-D /7 +n Windo#s ;< and 5* #or"station this shell is still present 9it is called the command prompt and you run it !y accessing the command prompt icon:7 *he @5+A shell is called the !ourne shell, and is a program called sh7 *here are other @5+A shell programs, nota!ly the "ourne shell and the c shell7
$evision Exercise (
0riefly explain the !ootstrap process7
%o# does an em!edded operating system differ from a general purpose operating system?
2;
SECTION FIVE
*earning Outcomes
At the end of this section you #ill !e a!le to
define the terms file, cluster, inode, sym!olic lin" descri!e a typical structure for the root file system list four typical entries for a root file entry explain ho# free space might !e managed list the file systems supported !y Windo#s descri!e #hat access or file control permissions are and #hy they might !e needed explain ho# the file space may !ecome fragmented, #hat effect this might have on performance, and ho# the pro!lem might !e corrected
What is a file?
A file of a collection of data that normally is stored on a secondary storage device such as a hard dis" or floppy dis"ette7
38
Windo#s associates applications 9programs: #ith specific file types7 2or example, the default application that opens to process a file of type 7txt is the 5otepad editor7
31
What is a cluster?
*o ma"e things a little simpler than managing a large num!er of sectors, the operating
32
system groups sectors together into a minimum allocation unit called a cluster7 When a re&uest to create a file occurs, the operating system allocates a cluster at a time until the all the data is stored7 *his raises a &uestion7 ow are all t.e clusters of a file linke! toget.er1 *he previous diagram also illustrates the lin"ing of the file clusters in a chain, #ith the last cluster signifying that there are no more clusters allocated to the file7 ne of the pro!lems of using clusters as a minimum storage allocation unit is the #astage of space7 ,onsider a cluster allocate of t#o sectors, each sector storing 182( !ytes 9or characters:7 *his means a minimum storage allocation of 28(< !ytes7 +f you stored a file containing the phrase L%elloM, then this #ould result in 28(3 unused !ytes in the cluster 9most operating systems store the length of the file, so there is no need to use an end of file mar"er, #hich #ould occupy an additional !yte:7 =ou might consider that a smaller allocation si'e !ased on the si'e of a sector #ould !e more efficient7 %o#ever, it !ecomes more complex to manage smaller cluster si'es and they ta"e up more space 9the ta!le !ecomes larger and it ta"es more time to go through all the entries:7
2A*32
5*2/
33
/ystem, designed to !e more efficient at handling files than the 2A* system7 +t spreads file ta!les throughout the dis", !eginning at the center of the storage space7 +t supports file compression and long filenames7
3(
Why is this a pro!lem? An operating system reads data from secondary storage in contiguous clusters more efficiently and faster than from non-contiguous clusters7 Windo#s operating systems such as Windo#s ;)4;< provide a defragmentation utility that scans the file system for fragmented files and moves them to a contiguous space7 *his results in faster loading and accessing of files7
$evision Exercise )
-ist 2 @$ operations that are associated #ith files7
3)
What is a cluster?
3.
SECTION SIX
*earning Outcomes
At the end of this section you #ill !e a!le to
descri!e the !asic differences !et#een line !ased and screen !ased editors explain the program translation se&uence using a suita!le diagram list four features provided !y an assem!ler compare the operation of a compiler and an interpreter explain the operation of a lin"er descri!e the difference !et#een a locator and a loader detail a scenario #here a cross assem!ler #ould !e re&uired
/ 2*WA$E *
-/
*his section introduces you to some of the utilities associated #ith the development of programs7 *hese program development tools allo# users to #rite and construct programs that the operating system 9or another: can run7
ED+* $/
Editors are programs used to create documents7 *hey provide facilities for
-oading4Editing4/aving of source documents ,hange4$eplace text strings, characters or #ords 2ind4/earch for text strings, characters or #ords >ove4,opy4Delete !loc"s of text
Editors consist of t#o !asic types, line !ased and screen !ased7 *ine Base! E!itors *he line !ased editor presents a single line for editing7 Each line may !e called up in turn7 *he left and right cursor "eys may !e used to edit the line of text7 /tandard facilities exist to perform search4find4replace4move items of text7 *hese types of editors are cheap, provide a !asic set of functions, and are reasona!ly small in terms of code si'e7 A limited num!er of commands are offered that people can &uic"ly learn7 Examples of line-!ased editors are edlin and vi7 Screen Base! E!itors *hese provide a range of enhanced features, and editing is performed using the #hole screen 9multiple lines are sho#n at a time:7 *he cursor may !e moved in any of the four directions7 3rovision is made for scrolling the text #hen the cursor exceeds the !oundary of the display #indo#7 /creen !ased editors are normally #ritten for specific types of computers, and thus tend to !e more costly, !ut provide a greater
3?
range of facilities, and can !e more readily customi'ed for particular applications 9such as standard mail4form generation:7 *he screen editors may !e command driven, #here all functions to !e performed are entered as commands on a single command line, or may !e "ey generated, #here pressing certain "eys perform the desired function7 ,ommand driven editors tend to !e the easiest and &uic"est to learn7 0y displaying more than one line at a time, screen editors facilitate the speedy modifications re&uired for source documents7 Examples of screen-!ased editors are 5otepad, Word3ad, and Word 28887
A//E>0-E$/
Assem!lers are programs that generate machine code instructions from a source code program #ritten in assem!ly language7 *he features provided !y an assem!ler are,
allo#s the programmer to use mnemonics #hen #riting source code programs7 varia!les are represented !y sym!olic names, not as memory locations sym!olic code is easier to read and follo# error chec"ing is provided changes can !e &uic"ly and easily incorporated #ith a re-assem!ly programming aids are included for relocation and expression evaluation7
%.at is an assem"ler mnemonic1 A mnemonic is an a!!reviation for a machine code statement7 During the translation phase, each mnemonic is translated to an e&uivalent machine code instruction7 3<
> E AA, 8ffh is translated to the !inary !it patterns 18111888 9this means > E AA: 11111111 9this is ff hexadecimal: 88888888 9this is 8: %.at are assem"ler pseu!o5ops1 Assem!lers also provide "ey#ords called pseudo-ops7 *hese "ey#ords provide directions 9hence they are also called assem!ler directives: to the assem!ler7 3seudoops do not generate machine instructions7 *he follo#ing pseudo-op D0 Ha!H allocates and initiali'es a !yte of storage for each character of the string, thus t#o !ytes #ill !e allocated, one initiali'ed to the character HaH #hilst the other !yte #ould !e initiali'ed to the character H!H7
%.at type of co!e !oes an assem"ler generate1 *he assem!ler does not normally generate executa!le code7 An assem!ler produces an o!6ect code file that must !e further processed 9lin"ed: in order to generate a file that can !e executed directly7 $n e3ample assem"ly language program
ORG 0100H hex STATUS: and is *O +: as a the the la%el ./0 *O + *O + !" #$H , AA STATUS ; H means hexadecimal values ;This program starts at address 0100 ;This %&te is identi'ied as STATUS( ;initiali)ed to a value o' #$ hex ;The la%el called *O + is identi'ied ;machine code instruction -hich loads ;A accumulator -ith the contents o' ;memor& location associated -ith the ;STATUS( ie( the value #$ ;.ump to the address associated -ith
generated per hour:7 @nli"e assem!ly language, it also means that the programmer does not need to learn the instruction set of each computer !eing #or"ed #ith7 All %-- statements must !e converted to machine code in order for a processor to run them7 *here are t#o #ays in #hich high level language statements are converted into machine code, either at runtime 9interpreted: or !efore runtime 9compiled:7
W%A* +/ A5 +5*E$3$E*E$?
*he source code program is run through a program called an interpreter7 Each line of the program is sent to the interpreter that converts it into e&uivalent machine code instructions7 *hese machine code instructions are then executed7 *he next source line is then fetched from memory, converted and executed7 *his process is repeated till the entire program has !een executed7 Examples of interpreted languages are 0A/+, 90eginners All 3urpose /ym!olic +nstruction ,ode: and Nava7 $n e3ample B$SIC program
10 #0 $0 50 60 40 90 R+/ 0rogram %& 111111111111111111 R+/ 2nitiali)e varia%les Time 3 4 Speed 3 600 istance 3 Time 7 Speed 0R28T istance +8
W%A* D E/ A , >3+-E$ D ?
,ompilers accept source programs #ritten in a high level language and produce o!6ect code programs that are then lin"ed #ith standard li!raries to produce an executa!le file7 ,ompilers generate code that is reasona!ly fast, !ut is target specific 9it only runs on a particular computer system:7 *he source program is :include ;stdio1h< #ritten using an editor7 main = >ost compiled languages print'>?Hello -orld@nAB; do not use line return 1; num!ers7*he example on C the right is a , program7 nce the program has !een #ritten using the appropriate source statements, it is then passed to a compiler that converts the entire program into o!6ect code7 *he o!6ect code cannot !e run on the computer system, so the o!6ect code file is then sent to a lin"er that com!ines it #ith li!raries 9other o!6ect code: to create an executa!le program7 0ecause the entire program is converted to machine code, it runs very &uic"ly7
(8
W%A* D E/ A -+5FE$ D ?
*he 0A/+, interpreter already has its o#n li!raries for +nput and utput 9+4 :, so 0A/+, programs donHt need lin"ing7 *he source program is converted directly into executa!le code7 ,ompiled languages 9as #ell as assem!led: need !oth lin"ing and loading7 *he output of compilers and assem!lers are stored in an intermediate format called o!6ect code7 *his is stored as a file on dis"7 *he o!6ect code must !e com!ined #ith other o!6ect code files or li!raries 9special o!6ect code files: !efore execution7 *he lin"er com!ines the programs o!6ect code #ith the runtime o!6ect code files 9for handling files, screen output, the "ey!oard etc: into an executa!le format7 *he types of files that exist at each phase of the program translation se&uence are, myprog7c source code program
myprog7o!6 o!6ect code produced !y compiler myprog7exe executa!le file produced !y lin"er
- ADE$/
+t is normally the responsi!ility of the perating /ystem to load and execute files7 *he part of the operating system that performs this function is called a loa!er7 T.e a"solute loa!er *here are t#o types of loaders, relocating and a!solute7 *he a!solute loader is the simplest and &uic"est of the t#o7 *he loader loads the file into memory at the location specified !y the !eginning portion 9header: of the file, then passes control to the program7 +f the memory space specified !y the header is currently in use, execution cannot proceed, and the user must #ait until the re&uested memory !ecomes free7 T.e relocating loa!er *he relocating loader #ill load the program any#here in memory, altering the various addresses as re&uired to ensure correct referencing7 *he decision as to #here in memory the program is placed is done !y the perating /ystem, not the programs header file7 *his is o!viously more efficient, !ut introduces a slight overhead in terms of a small delay #hilst all the relative offsets are calculated7 *he relocating loader can only relocate code that has !een produced !y a lin"er capa!le of producing relative code7 A loader is unnecessary for interpreted languages, as the executa!le code is !uilt up into the memory of the computer7
(1
% $T IS $ *OC$TO&1 3rogram locators convert the output of the lin"er 9the executa!le file: into an a!solute load format file7 *his type of file #ill eventually reside in specific memory locations, and is used to em!ed soft#are into E3$ > chips7
W%A* +/ A D+/A//E>0-E$?
Disassem!lers convert machine code instructions into mnemonic opcodes and operands, facilitating de!ugging at the machine code level7 *he more sophisticated disassem!lers provide for
generation of sym!ols and la!els cross reference tools disassem!ly of memory or dis" files output of disassem!ly to dis" file relocation information
manipulation of memory manipulation of processor registers simple trace, single step, go commands !rea"points may!e a disassem!ler and inline assem!ler dis"4tape i4o
De!uggers provide much the same facilities as monitors, !ut generally provide a #ider range of features,
provision for %-- source de!ugging split screens, #indo#ing reference !y sym!ols, module names and la!els radix changing dynamic tracing of hard#are interrupts
(2
W%A* +/ A ,$ // A//E>0-E$?
,ross assem!lers allo# a programmer to develop machine code programs on one computer system for another system 9target:7 +n this #ay, a programmer can develop a machine code program for a >acintosh computer system using an +0>-3,7 *he cross-assem!ler running on the 3, generates the machine code instructions necessary for the >acintosh7
$evision Exercise .
-ist 2 @$ features of a line !ased editor7
What is a cross-assem!ler?
(3
SECTION SEVEN
*earning Outcomes
At the end of this section you #ill !e a!le to
identify common mouse cursors select and drag items using the mouse explain the difference !et#een tiling and cascading #indo#s given a screenshot, identify the "ey elements of a #indo# s#itch !et#een applications using the tas" !ar or the A-*-*a! "ey
*he mouse
*he mouse, invented in 1;.3 at the /tanford $esearch +nstitute !y Douglas Engel!art, has done much to enhance the use of the personal computer7 Engel!artHs prototype, made of #ood, #ith metal dis"s for rollers that detected the motion of the mouse, #as further developed !y Aerox at itHs 3alo Alto $esearch ,enter in the early 1;?8Hs under the direction of Nac" / %a#ley7 >ost mice have t#o or more !uttons, #hich users depress to select items from a menu or clic" on graphical o!6ects on the computer screen, thus sending commands to the computer7
*he mouse is held in the hand and moved across a flat surface7 As the mouse is moved, its movement is detected and translated into !oth A and = movements, #hich updates the indicated position of the mouse pointer on the computer screen accordingly7
((
Windo# 2undamentals
+n a graphical operating system, information is represented in graphical #ays7 -ittle sym!ols or pictures 9called icons: are used to display programs or information7 +nformation is displayed inside #indo#s, each of #hich has similar properties7 +t is possi!le to have more than one #indo# on the screen at one time, and #indo#s may !e casca!e! 9on top of one another: or tile! 9all displayed at once and all visi!le:7
()
+n this picture, the #indo#s have !een casca!e!7 *his ma"es each #indo# appear on top of each other, one after the other7 *he front most #indo# is considered to !e the active #indo#, ie, the #indo# to #hich the users commands #ill !e sent7 +n Windo#s;) or Windo#s5*, the title!ar of the #indo# is sho#n in the default color 0lue7 +n this picture, the images have !een tile!7 *his ma"es all #indo#s visi!le at the same time, !ut resi'es the dimensions of each #indo# so that they all fit on the availa!le screen space at once7
Tip2 *o cascade or tile all #indo#s on the des"top area, right mouse clic" on an empty portion of the tas"!ar and select ,ascade Windo#s or *ile Windo#s from the menu7
Windo# 3roperties
Each #indo# has the same properties and !ehaves the same #ay7 *his provides a consistent interface to the user, as all commands are the same for each #indo# and the operations that the user performs on each #indo# are identical7
(.
+n the diagram !elo#, #e see the !asic #indo# as presented !y Windo#s ;) or Windo#s 5*7 Each property is listed on the diagram, and !elo# is an explanation for each of the #indo# components7
T.e Title Bar *his normally displays the name of the program associated #ith the #indo#7 +f the !ac"ground color of the title !ar is !lue, the #indo# is active and any user commands #ill !e processed !y that #indo#7 =ou can also toggle !et#een a maximi'ed #indo# si'e and the #indo#s normal si'e !y dou!le clic"ing in the title !ar area7 T.e Control +enu ,lic"ing on the ,ontrol >enu pops up a small Windo# of selecta!le options, #hich include the operations of $estore, >ove, /i'e, >aximi'e, >inimi'e and ,lose the Windo#7 T.e ori8ontal an! )ertical Scroll Bars When the amount of information displayed in the #indo# exceeds the vie#ing space of the #indo#, scroll !ars are automatically to the side and !ottom of the #indo#7 *his allo#s the user to scroll the contents of the #indo# in order to vie# the remaining information7 Arro#s are used to indicate the direction of scrolling on the scroll !ar, and an indicator !ar represents the relative position of the vie#ing area compared to the total si'e of the information7 ,lic"ing on the arro#s associated #ith the scroll !ar move the vie#ing #indo# up or do#n one line, or across or !ac" one character position7 =ou can also clic" on the small indicator !ar #ithin the scroll !ar and drag it #ith the mouse to &uic"ly scroll the #indo#s contents7 T.e +inimi8e +a3imi8e Close %in!ow Buttons *hese !uttons are located on the top right corner of each #indo#7 ,lic"ing on them once performs the desired action associated #ith the !utton7
(?
*he minimi'e !utton reduces the #indo# and places it on the tas"!ar at the !ottom of the #indo#7 *he maximi'e !utton expands the #indo# to fill the entire des"top screen area7 *he close !utton closes the #indo#7
Tip2 *o minimi'e all #indo#s on the des"top area, right mouse clic" on an empty portion of the tas"!ar and select >inimi'e all Windo#s from the menu7
*he menu !ar presents a num!er of options that the program associated #ith the Windo# supports7 ,lic"ing on an option on the menu !ar #ill popup a su!menu of choices that you can select from7
T.e %in!ows Bor!ers *he #indo#s !orders sho# the dimensions of the #indo#7 Any #indo# can !e resi'ed, either made smaller or larger, !y dragging the #indo# !order appropriately7
To make t.e win!ow taller or s.orter2 >ove the mouse pointer to either the top or !ottom #indo# !order, and #hen it changes to a resi'e arro# , then hold the left mouse !utton do#n and drag the #indo# !order to its ne# position, then let release the left mouse !utton7 To make t.e win!ow narrower or wi!er >ove the mouse pointer to either the left or right #indo# !order, and #hen it changes to a resi'e arro# , then hold the left mouse !utton do#n and drag the #indo# !order to its ne# position, then let release the left mouse !utton7
+o0ing a %in!ow A #indo# can !e repositioned on the des"top screen display area !y moving the mouse cursor into the title !ar area, then holding the left mouse !utton do#n and dragging the #indo# to the ne# position, then releasing the left mouse !utton7
(<
Switc.ing "etween %in!ows When you have multiple #indo#s displayed on the des"top screen area, you can s#itch !et#een #indo#s !y clic"ing on the programs icon on the tas"!ar or pressing A-*-*A0 "eys on the "ey!oard7 When you press A-*-*A0, it #ill pop up a #indo# of the availa!le programs7 %old the A-* "ey do#n, and pressing the ta! "ey #ill move the selection to the next #indo# in the list7 When the desired #indo# is highlighted, release the A-* "ey and that #indo# #ill !ecome active7 ,lic"ing on the applications icon on the tas"!ar can also do s#itching to another application7 *he follo#ing picture sho#s the Windo#s tas"!ar, located at the !ottom of the screen7
*his picture sho#s the A-*-*A0 pop up #indo#, #hich list the availa!le programs the user can s#itch to7
(;
SECTION EIGHT
*earning Outcomes
At the end of this section you #ill !e a!le to
given a screen capture, identify radio !uttons, text !oxes, chec" !uttons, dialog !oxes, list !oxes and drop do#n list !oxes use tool!ars and ta! controls to select items or perform tas"s
*ext 0oxes
*ext !oxes allo# you to enter text information7 *o enter text, first clic" inside the text area using the mouse, and the cursor #ill change to a vertical flashing !ar O sho#ing you that text can no# !e entered7 +n this image, a text !ox allo#s the user to specify a file to find on the computer7 *he name of the text !ox entry field is called 5amedP
$adio 0uttons
$adio !uttons allo# users to select one of a num!er of options from a selection7 +n the follo#ing image, a choice !et#een *iled and ,entered is offered7 A radio !utton is ena!led #hen there is a !lac" dot in its center7 A radio !utton is disa!led #hen it is empty7 *o ena!le a radio !utton, simply clic" once on it7 *o disa!le a radio !utton that is ena!led, simply clic" once on it7 +t #or"s li"e a toggle s#itch7
)8
,hec" 0oxes
,hec" !oxes allo# users to select one or more options from a selection7 +n the follo#ing image, the options /ho# #indo# contents #hile dragging, /ho# icons using all possi!le colors and /tretch des"top #allpaper to fit the screen are all ena!led7 A chec" !ox is ena!led #hen it has a tic" in it, #hen a chec" !ox is empty, that option is not selected7 *o ena!le a chec" !ox, simply clic" once on it7 *o disa!le a chec" !ox that is ena!led, simply clic" once on it7 +t #or"s li"e a toggle s#itch7
Dialog 0oxes
Dialog !oxes allo# you to ma"e choices and enter data7 *hey com!ine text !oxes #ith radio !uttons and chec" !oxes7 *o close a dialog !ox, press the E/, "ey7
-ist 0oxes
-ist !oxes present a num!er of choices7 =ou select one !y dou!le-clic"ing on the item you #ant7 ften the list of choices is in a scrolla!le #indo# !ox7
)1
+n this example, the %elp dialog !ox of Windo#s lists a num!er of help topics that the user can dou!le-clic" on to reveal the help associated #ith that item7
)2
5otice the sym!ol at the end of the !ox7 ,lic"ing on this sym!ol reveals the list of options7
*a! ,ontrols
*a! controls allo# a num!er of different dialog !oxes associated #ith a device to !e presented as a single com!ined control7 2or instance, if #e loo"ed at the screen display in Windo#s, there are so many things that can !e changed, li"e screen saver, #all-paper, si'e and resolution, video display driver and so on7 3utting all of these on a single dialog !ox is cum!ersome and there is 6ust not enough screen real estate7 /o, a num!er of dialog !oxes are used, !ut they are com!ined using the ta! control7 +t loo"s li"e multiple sections, and each ta! has a heading7 ,lic"ing on the ta! item reveals the dialog !ox associated #ith that ta!7 +n this example, the ta! control for the Windo#s des"top properties is displayed7 5ote there are 2 @$ distinct dialog !oxesQ the current choice is /creen /aver7
*ool!ars
*ool!ars appear on a num!er of #indo#s and application programs7 An example is the >y ,omputer #indo#7
)3
*he tool!ar is displayed underneath the >enu 0ar ptions of the #indo#7 An expanded vie# loo"s li"e
*he tool!ar consists of a num!er of icons 9little pictures:, each representing a command7 As the mouse cursor is moved along each icon, a text description #ill pop up revealing the availa!le control that is underneath the mouse cursor7
*ool!ars provide shortcuts to regularly used operations li"e cut and paste, close, and %elp7
)(
SECTION NINE
*earning Outcomes
At the end of this section you #ill !e a!le to
list the system re&uirements for Windo#s ;), Windo#s 5* and Windo#s 2888 3rofessional state the general features of Windo#s operating systems
))
Easy installation
Windo#s can !e installed from floppy dis", ,D$ >, or via a net#or"7 Windo#s uses an installation #i'ard, a graphical program designed to ma"e installation of the operating system simpler and friendlier7 3reviously, #hen installing >/D / or Windo#s 371 operating systems, additional programs need to !e run after installation to add support for devices li"e ,D-$ >Hs or sound cards7 *he Windo#s #i'ard ta"es care of this, automatically searching the computer for hard#are devices li"e printers, net#or" cards, ,D-$ > drives, sound cards and modems then installs the soft#are for these at installation time7 *his means Windo#s is easier to install and configure than previous operating systems7 As the Windo#s installation #i'ard detects #hat the computer hard#are is, it modifies the display screens accordingly7 @sing a set of easy to follo# menus and dialog !oxes, it guides the installer through the installation process7 When the installation #i'ard is finished, it prompts the installer to re!oot the computer7 At this stage, the computer has !een fully installed #ith the operating system and #ill !e ready to use after the re!oot7 +t ta"es approximately 28-38 minutes to install Windo#s from ,D-$ >7
1raphical +nterface
Windo#s offers an improved user interface called the !esktop7 *he des"top consists of a screen area, and a tas"!ar, #hich is !y default at the !ottom of the screen7 *he tas"!ar is used for starting programs, or s#itching !et#een programs7 As the user starts each program, the name of the program is displayed on the tas"!ar7 ,lic"ing on the name of the program on the tas"!ar #ill display the #indo# associated #ith that program on the des"top7
*he far right end of the tas" !ar also displays the current time and other controls7 T.e Start "utton on the tas"!ar displays a cascading menu of program choices7 When a user clic"s on the /tart !utton, a pop up menu appears7 *his provides easy access to installed applications7 ).
T.e +y Computer Icon on the des"top is a shortcut to vie#ing #hat is on your computer7 Dou!le-clic"ing an icon on the des"top displays the information #ithin a #indo#7 T.e &ecycle Bin Icon on the des"top is used to hold recently deleted files7 When you delete a program or file, it is saved in the recycle !in 6ust in case you deleted it !y accident7 *his allo#s you to recover from mista"es #hen you delete something you should not have7 T.e Network Neig."or.oo! Icon on the des"top is used to display the various resources li"e servers and applications availa!le on the net#or" 9assuming the computer is net#or" ena!led:7
Add4$emove 3rograms
Adding and removing programs is also easier7 3reviously, the removal of programs #as very difficult7 @nder Windo#s, a record is "ept trac" of the files installed and used !y programs7 *he use of installation #i'ards helps install and remove programs, so that #hen a program is removed, parts used !y other programs are left intact7
5et#or"ing /upport
Windo#s supports a #ide num!er of protocols and net#or"s7 *his allo#s easy connection to !oth >icrosoft and non->icrosoft net#or"s7 Internet &ea!y2 Dial up networking an! Internet E3plorer Windo#s comes #ith Dial-up net#or" support, ma"ing an +nternet connection to an +nternet service provider 9+/3: an easy tas" via a setup #i'ard7 +n addition, under Windo#s, a user can configure the dial-up net#or"ing to support more than one +/37 +nternet explorer is provided for users to !ro#se the World Wide We!7 /tandard 2*3 and *elnet programs are provided7
)?