Вы находитесь на странице: 1из 57

BTEC National Diploma/Certificate In Computing (Networking) Operating Systems

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

SECTION ONE : Part 1

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

What is an operating system?


An operating system 9 /: is a collection of system programs that together control the operation of a computer system7 *ypical operating systems are Windo#s ;< and -inux7 An operating system generally only runs on a specific hard#are platform7 2or instance, Windo#s ;< only runs on computer systems !ased on +ntel pentium processors7 =ou can learn more a!out Windo#s ;< at the >icrosoft We! /ite7

What does an operating system do?


An operating system controls the #ay in #hich the computer system functions7 +n order to do this, the operating system includes programs that

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

Where are operating systems found?

*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 general-purpose operating system?


Windo#s 5* Wor"station is "no#n as a generalpurpose operating system7 *his is !ecause it provides the a!ility to run a num!er of different programs, such as games, #ord processing, !usiness applications and program development tools7

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

Dedicated perating /ystems


An operating system designed for a single purpose is often called a dedicated operating system7 +t performs a specific purpose, such as controlling the environment in a !uilding, controlling a petrol pump, or opening and closing an automatic door7 Dedicated operating systems cannot !e used to run other types of programs such as games or !usiness soft#are7

A simple operating system for a security control system


An operating system for a security control system 9such as a home alarm system: #ould consist of a num!er of programs7 ne of these programs #ould gain control of the computer system #hen it is po#ered on, and initiali'e the system7

*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

What are +nput and utput devices?


+nput and output devices are components that form part of the computer system7 *hese devices are controlled !y the operating system7 +nput devices provide input signals such as commands to the operating system7 *hese commands received from input devices instruct the operating system to perform some tas" or control its !ehavior7 *ypical input devices are a "ey!oard, mouse, temperature sensor, air-flo# valve or door s#itch7 +n the previous example of our simple security control system, the input devices could !e door s#itches, alarm "eypad panel and smo"e detector units7 utput devices are instruments that receive commands or information from the operating system7 *ypical output devices are monitor screens, printers, spea"ers, alarm !ells, fans, pumps, control valves, light !ul!s and sirens7

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

<

SECTION ONE : Part 2

What is a single-user operating system?


We are all familiar #ith the concept of sitting do#n at a computer system and #riting documents or performing some tas" such as #riting a letter7 +n this instance there is one "ey!oard and one monitor that you interact #ith7 perating systems such as Windo#s ;), Windo#s 5* Wor"station and Windo#s 2888 professional are essentially single user operating systems7 *hey provide you the capa!ility to perform tas"s on the computer system such as #riting programs and documents, printing and accessing files7 ,onsider a typical home computer7 *here is a single "ey!oard and mouse that accept input commands, and a single monitor to display information output7 *here may also !e a printer for the printing of documents and images7 +n essence, a single-user operating system provides access to the computer system !y a single user at a time7 +f another user needs access to the computer system, they must #ait till the current user finishes #hat they are doing and leaves7 /tudents in computer la!s at colleges or @niversity often experience this7 =ou might also have experienced this at home, #here you #ant to use the computer !ut someone else is currently using it7 =ou have to #ait for them to finish !efore you can use the computer system7

What is a multi-user operating system?


A multi-user operating system lets more than one user access the computer system at one time7 Access to the computer system is normally provided via a net#or", so that users access the computer remotely using a terminal or other computer7 +n the early days of large multi-user computers, multiple terminals 9"ey!oards and associated monitors: #ere provided7 *hese terminals sent their commands to the main multi-user computer for processing, and the results #ere then displayed on the associated terminal monitor screen7 *erminals #ere hard#ired directly to the multi-user computer system7

*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

perating system utilities


*he operating system consists of hundreds of thousands of lines of program instructions and these are stored on hard dis" of the computer7 3ortions of the operating system are loaded into computer system memory 9$A>: #hen needed7 *o manage the computer system, users, printers, files and #rite programs, the operating system is generally provided #ith a num!er of utility programs7 *he utilities are used for

>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

perating /ystem +nterfaces


+n addition, the operating system provides each user #ith an interface that accepts, interprets and executes user commands or programs7 *his interface is commonly called a /%E-- or command line interpreter 9,-+:7 +n some systems this might !e a simple text mode line-!y-line entry using "ey#ords 9such as >/D / or @5+A:, in

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

Advantages and pro!lems of multi-user operating systems


*he advantage of having a multi-user operating system is that normally the hard#are is very expensive, and it lets a num!er of users share this expensive resource7 *his means the cost is divided amongst the users7 +t also ma"es !etter use of the resources7 /ince the resources are shared, they are more li"ely to !e in use than sitting idle !eing unproductive7 ne pro!lem #ith multi-user computer systems is that as more users access it, the performance !ecomes slo#er and slo#er7 Another disadvantage is the cost of hard#are, as a multi-user operating system re&uires a lot of dis" space and memory7 +n addition, the actual soft#are for multi-user operating systems tend to cost more than single-user operating systems7

What is a multi-tas"ing operating system?


A multi-tas"ing operating system provides the a!ility to run more than one program at once7 2or example, a user could !e running a #ord processing pac"age, printing a document, copying files to the floppy dis" and !ac"ing up selected files to a tape unit7 Each of these tas"s the user is doing appears to !e running at the same time7 A multi-tas"ing operating system has the advantage of letting the user run more than one tas" at once, so this leads to increased productivity7 *he disadvantage is that more programs that are run !y the user, the more memory that is re&uired7

%.at is software an! w.at is application software1


/oft#are is 6ust another name for program7 We often use the term to refer to a group of programs7 2or example, you might get as"ed the &uestion B#hat sort of soft#are do you have?B7 +n this case, the person is as"ing you #hat types of soft#are do you have, and ho# many different soft#are programs do you have7 + guess you could thin" of someone as"ing a sna"e collector the &uestion BWhat sort of sna"es do you have?B7 2or the sna"e collector, they o!viously have many different types and sometimes several of the same species7 /oft#are is similar7 /o you might respond to such a &uestion !y ans#ering that you have some #ord processing soft#are such as >icrosoft Word and some games such as Cua"e and /im ,ity7 Application soft#are excludes the operating system and those programs that are part of the operating system7 +n general, you !uy application soft#are for your computer7 An example might !e a #ord processor or a reference atlas7

11

%.at are general categories of application software1


+n general, soft#are is divided into a num!er of general categories7 Business 0usiness soft#are allo#s users to perform tas"s related to running a !usiness, such as paying accounts, "eeping trac" of goods and items for sale, inventory soft#are and #riting reports7 Examples of !usiness soft#are are >icrosoft Wor"s and -otus 5otes7 Education soft#are is designed to teach or educate users7 *hese include encylodedias, reference !oo"s and instructional programs7

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

PART TWO : Section 1

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

What are the various parts of an perating /ystem?


+n this section #e loo" at that part of the operating system that is responsi!le for running programs, called the real-time executive or "ernel7 An operating system for a large-scale computer that is used !y many people at once is a very complex system7 +t contains many millions of lines of instructions 9commands that the computer executes: #ritten !y programmers7 *o ma"e operating systems easier to #rite, they are constructed as a series of modules 9programs:, each module responsi!le for one function7 *ypical modules in a larger multi-user operating system could !e,

Fernel 9also "no#n as the real-time executive: 3rocess manager /cheduler 2ile manager

What is a real-time executive?


*he core or central part of all operating systems is called a $EA- *+>E EAE,@*+EE 9also "no#n as the "ernel:7 /ome of the functions that the "ernel performs are

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

What is a computer program?


3rograms are a series of instructions to the computer7 When a soft#are programmer 9a person #ho #rites programs to run on a computer system: develops a program, it is converted into a long list of instructions that is executed !y the computer system7 +n operating systems #e tal" more of a process 9part of a program that is in some stage of execution: than a program7 *his is !ecause in modern operating systems, only a portion of a program is loaded at any one time7 *he rest of the program sits #aiting on a dis" unit till it is needed7 *his saves memory space7

%.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

%o# do operating systems run more than one program at once?


/ome systems run only a single process at a time, other systems run multiple processes at once7 >ost computer systems are single processor !ased, and a processor can only execute one instruction at a time, so ho# is it possi!le for such a single processor system run multiple processes? *he simple ans#er is that it doesnGt7 *he processor of the computer runs one process for a short period of time, then is s#itched 1)

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

What is co-operative and preemptive s#itching?


+n a computer system that supports more than one process at once, some mechanism must !e used to s#itch from one tas" to another7 *here are t#o main methods used to perform this s#itching7

,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

SECTION TWO : Part 2

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

What is system overhead?


*he amount of time that is spent in the system state 9running the "ernel and performing tas"s li"e s#itching !et#een user programs: is called the system o0er.ea!, and should typically !e !elo# 18I7 *oo much time spent performing system tas"s in preference to running user programs #ill result in poor performance for user programs, #hich #ill appear to run very slo#ly7

What is re&uired to s#itch from one program to another?


*his s#itching !et#een user programs is done !y part of the "ernel7 *o s#itch from one program to another re&uires,

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

What is context s#itching?


When the processor is s#itched from one process to another, the state 9processor registers and associated data: must !e saved, !ecause at some later date the process

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

ther #ays of scheduling processes


+t is common no# in operating systems today for processes to !e treated according to priority7 *his may involve a num!er a different &ueues and scheduling mechanisms, using priority !ased on previous process activity, ho# it has !een executing for and ho# long it has !een since it last #as executed !y the processor7

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

What a!out process states?


A process in a computer system may !e in one of a num!er of different possi!le states, such as rea!y - if it can run #hen the processor !ecomes free running - it currently has the processor "locke! - it cannot run #hen the processor !ecomes free When a running process is interrupted !y the processor after completing its allotted time, its state is saved in its process control !loc", its process state changed to ready and its priority ad6usted7 When a running process accesses an input or output device, or for some reason cannot continue, it is interrupted !y the processor, the process state and associated data is

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:

What is a process control !loc"?


A process control !loc" or 3,0 is a data structure 9a ta!le: that holds information a!out a process7 Every process or program that runs needs a 3,07 When a user re&uests to run a particular program, the operating system constructs a process control !loc" for that program7 *ypical information that is stored in a process control !loc" is

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

%o# do processes inter-communicate?


3rocesses can intercommunicate !y sending messages, data or code !et#een them7 A process can use / calls li"e sendmessage9: and getmessage9: to exchange messages7 *#o processes might #ant to co-operate in performing a particular tas"7 2or example a process might #ant to print to document in response to a user re&uest, so it starts another process to handle the printing and sends a message to it to start printing7 nce the process handling the printing re&uest finishes, it sends a message !ac" to the original process, #hich reads the message and uses this to pop up a dialog !ox informing the user that the document has !een printed7 *here are other #ays in #hich processes can communicate #ith each other, such as using a shared memory space7

22

%o# do processes synchroni'e their activity?


/ometimes a process may need to #ait for some other process to finish !efore it can continue7 +n this instance, the t#o processes need to !e synchroni'ed together7 *here are a num!er of #ays in #hich this can !e done7 A common method in operating systems is to use a varia!le called a semap.ore that only one process can o#n at a time7 *here are t#o calls associated #ith a semaphore, one to loc" it and one to unloc" it7 When a process attempts to loc" a semaphore, it #ill !e successful if the semaphore is free7 +f the semaphore is already loc"ed, the process re&uesting the loc" #ill !e !loc"ed and remain !loc"ed till the process that has the semaphore unloc"s it7 When that happens, the process that #as !loc"ed #ill !e un!loc"ed and the semaphore can then !e loc"ed !y it7 System semap.ores are used !y the operating system to control system resources7 A program can !e assigned a resource !y getting a semaphore 9via a system call to the operating system:7 When the resource is no longer needed, the semaphore is returned to the operating system, #hich can then allocate it to another program7

%o# do processes protect critical data 9,ritical sections:?


When t#o or more processes access shared data, often the data must !e protected during access7 *ypically, a process that reads data from a shared &ueue cannot read it #hilst the data is currently !eing #ritten or its value !eing changed7 Where a process is considered that it cannot !e interrupted #hilst performing a critical function such as updating data, it is prevented from !eing interrupted !y the operating system till it has completed the update7 During this time, the process is said to !e in its critical section7 nce the process has #ritten the data, it can then !e interrupted and other processes can also run7 3ro!lems occur only #hen !oth tas"s attempt to read and #rite the data at the same time7 *he ans#er is simple, loc" the data structure #hilst accessing 9semaphores or interrupts disa!led:7 *here is no need for data loc"ing if !oth processes only read at same time7 ,ritical sections of a process should !e small so that they do not ta"e long to execute and thus other processes can run7

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

What is a !ac"ground and foreground process?


>ulti-tas"ing systems support foreground and !ac"ground processes 9tas"s:7 A foreground tas" is one that the user interacts directly #ith using the "ey!oard and

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?

,omplete the follo#ing process state transition diagram7

What is a process control !loc"?

-ist 2 @$ things a process control !loc" holds7

What is a semaphore?

2(

What is a critical section?

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

%o# does an perating /ystem load itself?


+n this section #e loo" at ho# the operating system loads #hen the computer is first turned on7 *he operating system may !e loaded into the computers memory in t#o #ays7

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

What are the different types of perating /ystems?


perating systems are divided into categories that define their characteristics7 >odern systems may use com!inations of those descri!ed !elo#7 B$TC *he earliest type, allo#ed only one program to run at a time7 *he program #as entered into the computer, then run till completed7 *he data used !y the program could not !e modified #hilst the program #as running7 Any errors in the program or data mean starting all over again7 *hese allo# the modification and entry of data #hilst the program is running7 *ypical systems are airline reservations and languages such as 0A/+,7 *hese share the computer system amongst more than one user, and employ pre-emptive scheduling techni&ues7 >ore than one process may !e executed at once7 *he processor is s#itched rapidly !et#een the processes7 A user may run more than one process at a time7 3rimarily used in process control, telecommunications, etc7 *he / monitors various inputs #hich affect the execution of processes,

INTE&5$CTI)E

TI+E5S $&IN,/+(*TI5 (SE&

+(*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

*hese are examples of em!edded systems7

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

0riefly explain ho# the !atch operating system #or"ed7

0riefly explain #hat an em!edded operating system is7

%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

A-- A0 @* 2+-E >A5A1E>E5*


+n this section #e ta"e a !rief loo" at ho# the operating system deals #ith files7

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

What are the typical operations performed on files?


An operating system must provide a num!er of operations associated #ith files so that users can safely store and retrieve data7 *ypical operations are pen ,lose ,reate ,opy $ename -ist +n addition, operations on single data elements #ithin a file are supported !y $ead Write /ee"

38

What are 2ile ,ontrol 0loc"s?


2ile control !loc"s 92,0:, sometimes referred to as file descriptors, are data structures that hold information a!out a file7 When an operating system needs to access a file, it creates an associated file control !loc" to manage the file7 *he structure of the file control !loc" differs !et#een operating systems, !ut most file control !loc"s include the follo#ing parts 2ilename -ocation of file on secondary storage -ength of file Date and time or creation or last access

What a!out ho# #e name files?


Each operating system uses a specific convention or practice for naming files7 >/-D / @ses eight character file names, a dot, then a three-character extension that denotes the type of file7 2ilenames are not case-sensitive7 @5+A 2ilenames can !e up to 2)( characters long and are case-sensitive7 Windo#s 2ilenames can !e up to 2)) characters long and are not case-sensitive7

What are file types?


2ile types refer to classifying the content of the file, such as a program, text file, executa!le program or data file7 +n Windo#s operating systems, the file type is derived from the filename extension7 *ypical file types and their extensions are 'ile E3tension 'ile Type 7!as 7c 7dll 7doc 7exe 7txt !asic source program c source program system li!rary Word document executa!le program text file

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

%o# does an operating system "eep trac" of files?


*he hard dis" is comprised of a large num!er of se&uentially num!ered sectors7 As files are created, free sectors are allocated to hold the file contents and mar"ed as allocated7 *o "eep trac" of the sectors and #hether they are allocated or free, and to #hich file they !elong, the operating system maintains a num!er of ta!les7

What is a root file system?


When the operating system is first installed, it creates a root file system on the dis" that specifies ho# many sectors are availa!le and ho# they #ill !e allocated7 *he root file system is a ta!le of entries li"e a directory7 +n general, this is a fixed si'e, and once full, no more entries can !e added7 Each entry can !e either a file or another directory ta!le7 *he follo#ing ta!le depicts this structure7

What does a root file system entry loo" li"e?


*his is highly operating system specific, !ut an entry might loo" li"e, 5ame of file 0eginning cluster num!er -ength of file in !ytes *ype of file ,reation date and last modified right 2ile permissions 9an access control list:

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

%o# is free space managed?


*he operating system can maintain a ta!le of cluster entries, and mar" each cluster as either free or allocated7 *his #as a techni&ue used in the >/-D / operating system7 ther operating systems maintain a lin"ed list of free clusters, each free cluster pointing to the next free cluster7 As clusters are allocated, they are removed from the free cluster list7 When a file is deleted, the clusters that #ere allocated to it are added !ac" to the free cluster list7

What file systems are supported !y Windo#s operating systems?


*he Windo#s operating system supports the follo#ing file systems7 2A* *he >/-D / operating system introduced the 2ile Allocation *a!le system of "eeping trac" of file entries and free clusters7 2ilenames #here restricted to eight characters #ith an addition three characters signifying the file type7 *he 2A* ta!les #ere stored at the !eginning of the storage space7 An updated version of the 2A* system designed for Windo#s ;<7 +t supports file compression and long filenames7 Windo#s 5* introduced the 5* 2ile

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

What are access-control lists and file permissions?


+n multi-user operating systems, files may !e accessed !y multiple users7 3ermission rights associated #ith folders 9directories: and files are used to protect or restrict access to files7 +n @5+A these rights are "no#n as $ead, Write and Execute7 +n Windo#s 5* and Windo#s 2888 9using the 5*2/ file-system only as permissions are not supported #ith 2A*:, additional file permissions are availa!le7 +n @5+A, three groups of permissions apply to every file7 *he first group of permissions defines those of the o#ner of the file, and are a com!ination of the read, #rite and execute permissions7 *he second group of permissions defines those permissions for a group of users7 *he third group of permissions defines the permissions for everyone else except the o#ner and group mem!ers7

What is a sym!olic lin" or shortcut?


A sym!ol lin" is a filename that lin"s to another file7 ,onsider the case on a @5+A !ox #here three different mail pac"ages are availa!le7 *he administrator only #ants to reference the mail using the command LmailM, so the filename is made to point to 9or reference: the desired mail pac"age7 When the administrator runs the command LmailM, the appropriate mail pac"age that is referenced !y the sym!olic lin" runs7 +n Windo#s, a similar capa!ility is "no#n as a shortcut7

What is file-system integrity?


2ile-system integrity refers to #hether the file-system contains errors7 /ometimes this is caused !y a user turning off the computer system #ithout first shutting the computer do#n properly7 During the shutdo#n process, a flag can !e #ritten to the file-system7 At startup, this flag can !e detected, and if not present, means the computer system #as not shut do#n correctly7 @5+A provides the fsc" program to chec" the file-system7 *he Windo#s operating systems provide /candis" or ,h"ds" 9chec"dis":7

3(

What is fragmentation and #hat does defragging a drive do?


When files are created and data #ritten to the file, the operating system allocates space for the file from the free cluster list7 ver a period of time, the clusters that are allocated to a file may no longer !e se&uential 9contiguous or one after the after: !ut scattered over the dis"7

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

What is a 2ile ,ontrol 0loc"?

What is a root file-system?

3)

What is a cluster?

%o# does an operating system manage free space?

What is an access control list?

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

*%E 3$ 1$A> *$A5/-A*+ 5 /EC@E5,E


+n developing a soft#are program to accomplish a particular tas", the program developer chooses an appropriate language, develops the algorithm 9a se&uence of steps, #hich #hen carried out in the order prescri!ed, achieve the desired result:, implements this algorithm in the chosen language 9coding:, then tests and de!ugs the final result7 *here is also a pro!a!le maintenance phase7 When you #rite a program in a source language such as 3ascal or ,, the program statements 9in the source text file: needs to !e converted into the !inary !it-patterns #hich ma"e sense to the target processor 9the processor on #hich the soft#are #ill !e run:7 *his process of conversion is called translation7

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

W%A* +/ A %+1% -EEE- -A51@A1E?


+n a %--, one English type statement represents a se&uence of machine code statements7 Examples of a high level language are 3ascal, 0asic and ,7 %igh level languages are useful in developing complex soft#are, as they support complex data structures, and increase programmer productivity 9the num!er of lines of code 3;

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* D E/ A ,$ // $E2E$E5,E @*+-+*= D ?


*hese allo# the programmer to generate a ta!le that lists all sym!ols, la!els, names, modules etc7 Each occurrence is listed, and generally the source program is given line num!ers to facilitate this process7 *he cref utility should detect data varia!les and assign sym!ols to them, presenting a variety of formats 9!y name, module etc:7 *he cref ta!le is useful in de!ugging, as the programmer can ascertain in #hich modules a particular varia!le is referenced7

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

W%A* A$E DE0@11E$/ A5D > 5+* $/?


A monitor is a small program that allo#s machine code access7 A monitor provides,

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

perating /ystem calls and stac" tracing

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 does an assem!ler do?

What does a lin"er do?

%o# does an interpreter differ from a compiler?

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

0asic 2eatures of 1raphical +nterfaces


1raphical systems use #indo#s to display information and thus allo# more than one #indo# to !e displayed at any time7 Each #indo# is associated #ith a running program7 @ser input is derived from a "ey!oard and mouse7

*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

((

*he mouse cursor


*he position of the mouse is sho#n on the screen as the mouse cursor and is denoted !y a num!er of sym!ols7 /tandard mouse pointer +ndicates computer is !usy

/electing items #ith the >ouse


Single Click A single mouse clic" refers to moving the mouse pointer over the desired item and &uic"ly pressing the left mouse !utton once7 Dou"le Click A dou!le mouse clic" refers to moving the mouse pointer over the desired item and &uic"ly pressing the left mouse !utton t#ice in rapid succession7 Drag A drag or move operation is performed !y moving the mouse pointer over the desired item and holding the left mouse !utton do#n7 *he mouse is then used to move to drag the o!6ect or #indo# to the ne# position, then the left mouse !utton is released7

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

T.e +enu Bar

*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

Windo# o!6ects and components


*his section discusses #indo# options such as !uttons and dialog !oxes7

*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

Drop Do#n -ist 0oxes


*o minimi'e the amount of screen space, list !oxes can sometimes !e arranged as a drop do#n list !ox7 *his displays a single item, !ut #hen the list !ox is clic"ed on, the range of items pops up in a secondary #indo#7 A drop do#n list !ox is sho#n !elo#7 +n this example, it is part of the Dialog !ox associated #ith the Display 3roperties7

)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

What are the hard#are re&uirements of Windo#s operating systems?


*his section outlines the typical hard#are re&uirements for the Windo#s operating systems7 =ou should !e a#are that these are recommended figures, and in actual practice more memory and dis" space is recommended if you intend to run applications and programs in addition to the !ase Windo#s operating system7 System re4uirements for %in!ows 9: 3<.DA or higher (>0 memory or higher R<>0 recommendedS 3)-(8>0 dis" space 37)B floppy drive or ,D-$ > E1A or higher resolution graphics card System re4uirements for %in!ows 9; (<.DA4..>%' or higher 1.>0 memory or higher 1;)>0 dis" space ,D-$ > E1A or higher resolution graphics card System re4uirements for %in!ows NT %orkstation <#= 1. >0 $A> $ecommended (<.42)>%' or higher processor 118 >0 availa!le hard-dis" space E1A, /uper E1A, or video graphics adapter ,D-$ > drive7 System re4uirements for %in!ows >=== 7rofessional 133>%' 3entium compati!le processor .(>0 $A> 210 %ard dis" #ith .)8>0 availa!le free space /ingle or dual processor systems

))

What are the general features of Windo#s operating systems?


*his section outlines some of the more general features found in the Windo#s ;)4;< and Windo#s 5* Wor"station (78 operating systems7 Ease of installation 1raphical interface 3lug and play support Add4$emove programs 5et#or"ing /upport

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

3lug and 3lay /upport


Windo#s ma"es it much easier to add ne# hard#are7 +t supports 3lug and 3lay technology, #hich means ne# hard#are can !e added to the computer and Windo#s #ill automatically detect the ne# hard#are and install soft#are support for it #hen re!ooted7 3lease note that adding ne# hard#are first re&uires the computer to !e turned off !efore the hard#are is added7

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

)?

Вам также может понравиться