Certificate 1 Week 15 s2 Iaooss
Certificate 1 Week 15 s2 Iaooss
Certificate 1 Week 15 s2 Iaooss
Doyourememberwhathappenedthelasttimeyouswitchedonacomputer?
(Rememberthatacomputercanincludeyourbasicgamesmachineplayed
onyourtelevisionscreenorthepersonalcomputerthatyouarecurrently
usingtoreadthesenotes).Whenyoupushedtheswitchtoactivatethe
computer,itprobablymadevariousnoises,displayedinformationonthe
computerscreenortelevisionthatindicatedwhatthecomputerwasdoing
andeventuallystoppedatascreenthatwasfamiliartoyousuchas
MicrosoftWindows,Linuxoryourgameconsolescreen.Itthenwaited
foryoutodosomethingonyourcomputer.Ifyounowwantedtoplaya
gameonyourgamesconsoleortoreadthesenotesonlineusingtheInternet,
youusethevariousdevicesattachedtoyourcomputer.Thesedevices
includeyourcomputermonitor,yourkeyboard,yourjoystick,yourmouse,
yourCDdrive,yourmodem,etc.
So what caused your computer to work and run through these routines,
maybe make some sounds, display information on the screen and stop at a
specific screen? How do these attached devices interact between you, them
and the computer? Why is it that it automatically loads and runs the game in
your game console? What causes it to print a document when you push the
print button in your word processing or spreadsheet software? This is the job
of the computer operating system.
Definition
There are many definitions of what an operating system is, (simply search
for a definition on the Internet and you will find many variations on the
meaning). However, Webopedia at:
http://www.webopedia.com/TERM/O/operating_system.html defines an
operating system as the following.
Operating systems perform basic tasks, such as recognizing input from the
keyboard, sending output to the display screen, keeping track of files and
directories on the disk, and controlling peripheral devices such as disk
drives and printers.
Diagnoses problems
The operating system can also diagnose problems with hardware devices or
software programs. Although the operating system may not be able to fix the
problems, it will certainly flag the problem to the end-user so that a solution
can be investigated.
In the box that appears type the command cmd (without the quotes).
This will take you to the command line of Windows XP. From here you
can type commands to get the system to perform functions.
Type in dir (without the quotes). This will show you a directory
(folder) listing of files in the current directory.
Linux
If you are already at a command line prompt, after logging in, simply
type the command ls (without the quotes). This will give a directory
listing of the current folder.
OR
If you have logged into your Linux system in GUI mode, hold down
the <CTRL> <SHIFT> keys and press <F7>.
This will drop you to a command line login screen for your Linux
system.
Login using your supervisor name and password and type in the
command ls (without the quotes). This will give a directory listing of
the current folder.
Boot files These are the files that the computer needs to be able to
start itself (boot) into operation so that the user can perform basic tasks.
File management files These are the various files that allow the
system to manage its resources such as disk storage and retrieval.
Utility files These are sometimes called the add ons that allow the
user to manage the computer resources or configure the system
environment to the way they require it. Eg changing the background
image on your GUI computer.
Multi user Multi user systems allow more than one person to use
the operating system resources simultaneously. Obviously, two or more
people would not want to physically operate the same computer at the
same time, so the ability to do this is provided by network operating
systems. A network operating system allows many personal computers
to connect to other computers by means of communication media such
as cable or wireless links. These operating systems are more complex
than single user operating systems because they have to handle many
requests for devices, resources etc., by many different users at the same
time. For example, if three users on a network all try to print a
document on a single network printer at the same time, it is the Network
operating systems responsibility to ensure that the documents are held
on the hard disk (spooled/queued) until the printer is ready to receive
them. Multi user systems also provide security functions such as who
can access the system, what resources they can use when logged in,
what environment areas they can change, etc.
Single tasking These are operating systems in which only one task
can be performed by the operating system at any one time. That single
task must finish before the next task can be started. Eg in MS-DOS, if
you wanted to format a floppy disk, the computer would need to finish
that task before it gave control back to you to allow you perform the
next task. Early single user operating systems were single tasking.
Multi tasking-single user This means that a user can sit in front of
their computer (that is not attached to a network) and the computer
appears to do many tasks at the same time. Eg while the operating
system is printing a 100-page document on your printer, your database
program is sorting hundreds of records for you, while you play your
favourite card games, all at the same time. (Note that the computer does
not run these tasks concurrently as explained later).
Name
Computer type
Description
MS DOS
IBM-compatible
computers
Windows
IBM-compatible
computers
UNIX
LINUX
IBM-compatible
computers
Macintosh
OS
Apple Macintosh
As you now know, operating systems appear in many forms. However, they
all have the same characteristics in that they manage the basic devices
attached to the computer. The way that this management occurs and the way
that data is handled gives rise to other features of the operating system. We
have already discussed multi user in the previous section, but operating
systems can also be classified as batch systems, time sharing or real time.
Batch systems
In the very early days of electronic computing (1950s1960s), the operating
systems of the day were mainly used on large mainframe computers. These
computers and the associated operating system were expensive. (You may
have seen an old mainframe computer in some of the old spy movies
large rooms, many flashing lights and old tape drives spinning around).
However, these early operating systems were not classed as multi tasking
(or multi user). Therefore, they were not capable of running multiple tasks at
any one time. The jobs that the operating system was asked to do were
done one at a time. This meant that for a lot of the time, the CPU of the
computer sat idle, waiting for the operator to ask it to do something else or
waiting for some other task to complete (such as printing). To overcome
this, batch systems were introduced. The jobs that the computer was being
asked to do were submitted in batches. This meant that the CPU was now
busy for longer periods of time, thereby utilising CPU time and saving
money. An example that you may have seen was the very old punch card
systems. The punch cards were simply stacked on a card reader and each
card was fed through, one at a time, to the computer, and the computer
processed the data on the cards by means of holes in the cards. Common
tasks could simply be to process all the payroll information for the
employees that were paid every Thursday, etc. The output was not
considered to be timeframe-critical as in real time operating systems
(RTOSs).
Another problem with these early operating systems was that multi user
functions were not available. If you required a job to be done on the
computer, you generally had to ask the operator to do it for you. Batch
systems are still used today in some operating systems, although the
technology for using them has changed dramatically (no more punch cards)
and they are now multi user. Large organisations that still use mainframe
computers still use types of batch systems.
Time sharing
The concept of time sharing relates to the operating system that allows
multiple access to it. As more than one user accesses the operating system to
run their programs, save their files, print their documents etc, the CPU
divides its time (generally equally) between all the users, so each user gets a
slice of the CPUs time to process the jobs. These types of systems were
common from the 1960s to the early 1980s. Multiple users accessed
computers by using dumb terminals. These terminals consisted simply of a
screen and a keyboard and a connection (cable) to the computer. No data
processing was done at the terminal (compare that to todays network
operating systems). The processing was all done on the computer where the
operating system received the requests from the user to do something,
passed it on to the CPU and the CPU divided its time amongst the users to
process their tasks.
Real time
A real time operating system (RTOS) is where the operating system
guarantees to receive, analyse and produce output in a guaranteed time
frame. RTOSs are needed in areas such as navigation systems, where a
steady stream of input and output data is needed in real time, so that a vessel
can maintain a safe navigational course. A good example of this is in air
traffic controller systems where the radar screen needs to show the position
of planes in real time. An operating system displaying the position of planes
a few seconds or minutes after the event could cause them to be on a
collision course or even more disastrous consequences. RTOSs use a
scheme called pre-emptive scheduling. This means that the operating
system knows that when it receives various requests for tasks to be
completed (such as updating a radar screen), some tasks have higher priority
than others. Those tasks received and identified as high priority allows the
operating system to stop any current running tasks to start a new higher
priority task.
RTOSs are also sometimes embedded systems. This means that the
operating system is very small and is embedded (or hard coded) on some
type of device such as a microprocessor. An example would be a digital
speedometer on a motor vehicle. It needs to be real time to display your
current travelling speed, but the operating system code to achieve this would
be embedded on a small chip in the vehicles motor and would perform only
the one task.
10
Multi tasking
A multitasking system is capable of executing multiple processes or tasks,
from multiple users (seemingly) simultaneously. This makes the user/s
believe that the operating system is exclusively processing their activities.
The operating system controls this multi access and multi tasking by
protecting each users activities and keeping them away from each other.
This then (hopefully) avoids the possibility of system crashes or hang-ups.
So, theoretically, if one users process terminates abnormally, crashes or
hangs, the system is not affected and neither are the other users. Multi
tasking systems use the time slicing approach to carry out their activities,
where each of the processes are given a share of the CPU time. Multi
tasking is critical in real time operating systems.
Multi tasking can also be categorised as pre-emptive and co-operative.
Pre-emptive is where the operating system decides on which processes have
access to the CPU and when, such as in real time operating systems. The
operating system will interrupt (or force) a running process to stop if a more
critical process is waiting to be executed.
Co-operative is where the operating system doesnt decide but the process
itself voluntarily decides on when it will give up its processor time. So a
particular process could hog CPU time until it is finished. This is not
recommended for real time systems.
The more common method is for pre-emptive multi user systems.
11
12
The Bootstrap Loader program has basically one function: to load other
parts of the operating system into the computers memory so that it can be
used. Eventually the Bootstrap Loader gives control of the computer to the
rest of the operating system. These other parts of the OS include the File
Management schemes, the Memory Management schemes and loading the
different software drivers that communicate with the various devices.
The Bootstrap Loader program will then tell the system where to look for
the first file in the (DOS) operating system, called IO.SYS. IO.SYS is then
loaded into memory and it now takes over the boot process. It then looks for
an operating system file called MSDOS.SYS. This is then loaded into
memory and the system now looks for a program called COMMAND.COM,
which then takes permanent control of the computer. COMMAND.COM is
always resident in memory.
At this point the computer should basically be ready to accept input/output
data from the attached devices and the user.
Memory management
One of the most important tasks that an operating system does is manage the
memory requirements of your computer. We discussed earlier how current
day operating systems are Multi User. This means that many users will be
using the facilities of the computer at the same time, including its memory,
to run their own tasks. Imagine if you had ten people sitting and working
around your desk, and each of those people put their paperwork all over the
desk. The desk would soon become unmanageable, with the paperwork hard
to find or even lost. Eventually all ten people would probably not be able to
complete their tasks. Somebody needs to take control and organise the chaos
on a computer this is one of the jobs of the operating system.
As an example consider the process of using your word processor on your
computer. On your computer, you double-click an icon on your desktop to
load the program. This double-click sends a signal to the operating system
that you want to use this particular program. The operating system then
makes a request to the CPU to retrieve a copy of the program from the
computer disk. The CPU and operating system then find where on the disk
this program resides and starts to copy the program code from the disk into
the computers memory*. Once the code is stored in memory, the CPU then
executes the code and your program runs.
*This computer memory is called Random Access Memory (RAM). The
computer uses RAM because it basically has no moving parts. The data
stored in RAM can be quickly accessed electronically by the operating
system. No moving parts means quicker access time.
Once you have your word processor working, you may want to open up an
existing document. To do this, the same process basically happens, where
13
the document is loaded from the computers hard disk into RAM, so again
more storage space is required.
The problem with this scenario is that:
The programs and data cannot overlap or use memory that is currently
being used by other programs.
Virtual memory
If your computer runs out of space to store data in physical RAM, the
operating system must compensate for this somehow. (Remember that a
multi tasking system could have many programs and/or files open at once,
each needing resource space such as physical memory.) Most operating
systems do this by creating a swap file and Microsoft Windows uses this to
store its virtual memory.
When the computers RAM chips run out of space, the operating system
uses one of its programs called a Memory Manager. This Memory
Manager sets up a large contiguous (there are no gaps) file on your
computers hard disk (Note that sometimes, this file can be fragmented and
is called a temporary swap file). As the operating system determines that
your physical memory is full, it moves some of the data/programs that it
believes are not currently needed, but could be needed later, into the swap
file on the hard disk. Because it is contiguous, the operating system knows
exactly where this data is, if it needs to retrieve it again very quickly. The
14
size of the amount of space used by the swap file can also grow and shrink,
depending on system requirements and no other program/file/document will
ever be saved in the space being used by the swap file.
A problem with using a swap file is that it can slow down system
performance because the data has be read from the disk when it is required
and written to the disk when not needed. (There are not many moving parts
within a computer, but there are in a hard disk the disk itself that spins
and the read/write heads that move backwards and forwards across the disk
reading and writing the data. These moving parts always slow down access).
Another problem with swap files occurs when the available space on a
users hard drive shrinks through normal use, eg saving programs and files.
As the amount of free space on the hard disk reduces, the amount of space
available for the swap file is also reduced, thereby degrading system
performance significantly.
This virtual memory makes your computer think that it has more memory
than it actually has. Fortunately, the average computer user doesnt have to
worry about this, as it is handled automatically by the operating system and
associated software programs. Windows, Unix and Linux use this technique
of having a swap file. Large mainframe computers use a similar technique
called paging. The data that is moved in and out in these systems is called
pages. Linux actually creates an exclusive partition on your drive to use
for swapping.
15
16
Do not change anything in these screens. Click the Cancel buttons until you have
closed down the Control Panel.
File management
One of the most used pieces of an operating system, file management refers
to the way that the operating system manipulates, stores, retrieves and saves
data on mass storage devices. Each time you install a program onto your
computer, open and play a game, create and save a new document, delete an
old document or simply copy files from your hard drive to a CD or floppy
disk, etc, you are using the operating system file management programs.
The operating system may also implement security on files and programs
such as when a network operating system is used.
When files are stored on a mass storage device, these different devices can
vary in their structure, eg a CD-ROM, a hard Disk, a floppy disk, a tape, a
USB flash drive. It is important therefore that the operating system knows
how data can be stored on these devices as each have their own
characteristics of storing data. However, the operating system will nearly
17
always present the data on those devices to a user in a consistent view. That
is, as folders and files in a directory structure.
For a device to be able to store and retrieve data it needs to be set up by the
operating system to allow this. The techniques for setting up these devices
vary slightly depending on the device. For this discussion, we will
concentrate on a hard disk drive and the Microsoft disk operating system
(MS-DOS), but note that the concepts for most mass storage devices with
other operating systems are similar to what is discussed here.
Partitioning
When a hard disk drive (HDD) is first installed into a computer, and before
it can be used, the operating system needs to create a partition/s on the
drive. A HDD can have only one partition or many partitions. A partition is
simply the physical hard disk having an area or multiple separate areas to
hold data. An analogy would be a large roomy office. The room could
simply be used as one large office where everybody works together or we
could use room partitions and divide the room into separate working areas.
The end result is that we still have one physical room, but it is divided into
smaller separate areas where each staff person would have their own private
space and could be working on different items.
Partitioning a hard drive is similar to this. In the DOS and Windows
operating systems these separate areas of the HDD are identified by letters
of the alphabet. If we have one physical HDD and only have one partition,
then the drive is identified as the C: drive. If we partitioned the HDD into
four separate areas, then each is identified by a letter of the alphabet, ie C:,
D:, E:, F: etc, called logical drives. On a Linux and Unix system, (and
generally on Windows NT and Windows 200x server systems) the separate
areas are known as volumes and are identified by names rather than letters.
When the operating system creates these partitions, it creates a partition
table on the very first track of the hard drive. During the POST, the
operating system checks the partition table and verifies that they exist on the
disk. If the operating system finds that the partition information is invalid,
then the system normally stops and it will be unusable. If it finds the
partition table to be valid, it checks to see which partition has been
identified as the active partition. The active partition is identified and
created during the partitioning process. When an operating system is
installed on the HDD, the active partition tells the operating system that this
partition is the one to boot the computer from, eg if Windows 9x was
installed on the active partition then Windows 9x would be the default
operating system to load and run. If Linux was installed on the active
partition, then Linux would be the operating system loaded. (Note that it is
possible to have more than one operating system installed on a HDD in the
different partitions. Some operating systems will recognise this and present
the user with a menu from which they can select the operating system they
want to load.
18
Example
The screen below shows the results of running the MS-DOS FDISK
program, and that the computer simply has one partition, identified as C:
drive and it is marked active. It also displays the size of the partition in
megabytes and also the type of file system installed (FAT32).
Figure 3: A screen from the Microsoft FDISK program used for partitioning a HDD
Compare the above image to Figure 4 below. This is a screenshot from the
Windows XP partition program. Note how it shows that the C: drive (where
the mouse pointer is) on this system is the system partition and is the
equivalent to an active partition in MS-DOS. Also note that the different
shades of blue define the different types of partitions with the darker blue
being the primary partition and the lighter blue being the logical drives.
Formatting
Once you have partitioned the HDD, the formatting process is now
performed. Note that there are two types of formatting: low level and high
level. Low level formatting is generally done before the HDD leaves the
factory. Low level formatting divides the HDD into sectors (much like the
19
pieces in a pie) and tracks (separate concentric circles on the disk surface).
For our purpose, we will concentrate on what the average user can do
high-level formatting.
High-level formatting
High-level formatting of a HDD basically does four tasks:
1
Creates the sectors and tracks that are identified by the low level
format. Each sector can hold about 512 bytes (characters) of data per
track. Some operating systems allow this value to be increased.
Creates a master boot record (MBR). The MBR holds data that tells the
operating system about the structure of the disk. How many tracks, how
many sectors, etc.
Creates an area on the first track, (the outside track) called the file
allocation table (FAT). The FAT is like the index of a book. It holds
information that tells the operating system where the data (your
programs and documents) is physically stored on the disk. The format
process actually creates two copies of the FAT, in case one of the copies
is corrupted. (Each time you save or delete data from your disk, the
operating system updates this table.)
Creates the first directory (folder) on the disk called the root directory.
The root directory is simply the first directory on the disk. It is called
the root directory because directory structures are like trees every
other directory that is created on your disk grows from the root.
So how does the process work? Assume you are using your word processor
and you open an existing document on your hard disk. When this happens,
the application program tells the operating system that it wants to retrieve
this document from the hard drive. The operating system then consults the
FAT on the disk to determine the address of the file you want. (The address
is basically the track and the sector where it is stored). Once the operating
system knows where the file (or first part of the file) is located on the disk, it
then directs the actuator arm, (the piece of the hard drive that has the
read/write heads) to move to that address on the disk and start retrieving the
data. As the data is retrieved it is assembled into the correct order and sent
to the CPU, which then displays it on the screen. Note that the file may be
stored in many different sectors and tracks all over the disk, depending on
its size. This is known as fragmentation. When a file is saved on a disk, the
operating system looks for addresses which are not in use. Because you may
have saved/deleted many files of different sizes over time, the disk will have
empty addresses in different places all over the disk and the operating
system simply uses these empty addresses to store the data.
20
Summary
manages the various system resources and devices without the enduser needing to manage them
21