730 likes | 2.61k Views
The Functions of Operating Systems. Desktop PC Operating Systems. Learning Objectives. Describe the main components of a typical desktop PC operating system. Define the terms boot file and a file allocation table (FAT). Main components of a typical desktop PC operating system. HCI
E N D
The Functions of Operating Systems Desktop PC Operating Systems
Learning Objectives • Describe the main components of a typical desktop PC operating system. • Define the terms boot file and a file allocation table (FAT).
Main components of a typical desktop PC operating system • HCI • Type / allow communication. • Utility programs • Routines that the OS makes available to the user. • Hardware control/Input and Output • Software routines to control the hardware/device drivers • Multi tasking capability • Allows different Windows/user can carry on more than one task at a time. • Spooling • Queue jobs for input / printing / …
Main components of a typical desktop PC operating system • Security • Ensure that different users can keep files confidential. • Host software • Scheduler to schedule instructions. • Memory management • To allocate memory to data/software. • Interrupt handling • Schedule jobs through the system. • Translators • Produce object code.
Boot Program • A file containing commands to automatically configure a personal computer on start up. • Stored on the ROM as it is unchangeable. • Power-up process: • POST (power on self-test) • http://en.wikipedia.org/wiki/Power-on_self-test • The boot program then retrieves user-defined / configurable / changeable parameters stored in the boot file / Basic Input Output System (BIOS) and uses them to configure the system. • Note the BIOS in a PC is also known as autoexec.bat or config.sys. • Finally it loads the first instruction of the operating system into memory.
Format • A routine that is part of the OS which enables the OS to store and search for files in sectors on a disk. • Disk Structure • (A) Track • (B) Geometrical or mathematical Sector • (C) Track Sector / Computing Sector / Disk Sector • (D) Cluster • 2 or more track sectors.
Sector/ Disk sector • The word ‘sector’ in computing is used to mean a ‘track sector’. • Mathematically a sector is a ‘slice of the pie’ but in computing a sector means a ‘track sector’. • A sector is the smallest physical / accessible amount of data on a medium. • It is possible to think of a sector as a block but the word block in computing means data chunks of varying sizes in data streams so it is not used here.
Clusters • A unit of disk space allocated for files and directories. • The smallest logical amount of disk space that can be allocated to hold a file. • Large clusters means small files will waste disk space called ‘slack space’. • However, large cluster sizes reduces bookkeeping overhead and fragmentation, which may improve reading and writing speed overall. • So a balance is required usually meaning that a cluster is around the size of an average file.
File Allocation Table (FAT) • Enables the OS to find files on a disk and to be able to store user's files. • i.e. Maintain and manage disk space used for file storage. • Uses linked lists to point to the blocks on the disk that contain each file (each linked list contains the addresses of each memory block that contains the file in question, if followed the file “units” will be found in the same order as the original file). • However, to find the first file “unit” a “Root Directory” table is used, this lists the files and their starting clusters. • See next few slides for diagrams and more detailed explanations.
File Allocation Table (FAT)(map to each cluster on the volume) • The first column gives the cluster number and the second column is a pointer to the next cluster used to store a file. • The last cluster used has a null pointer (usually FFFFH) to indicate the end of the linking. • The directory entry for a file has a pointer to the first cluster in the FAT table. • The diagram shows details of two files stored on a disk. • Note the actual contents of each cluster (the ‘parts’ of each file) is not shown here. Only the pointer to the next ‘part’ of the file.
Storage Clusters on a disk • In order to find a file, the OS looks in the directory for the filename and, if it finds it, the OS gets the cluster number for the start of the file. • The OS can then follow the pointers in the FAT to find the rest of the file.
Opening a file Find the filename in the FAT Root Directorytable. Look up the Starting Cluster. Go to that cluster and retrieve the data. Go to the FAT table and find the starting cluster and then look up the Pointer Cluster. Go to that cluster and retrieve the data (combining it with previous data for the file). Repeat steps 3 – 5 until a null pointer is found (which indicates the end of the file).
File Allocation Table (FAT) • Unused clusters have a zero entry pointer. • When a file is deleted, the clusters that were used to save the file are set to zero pointer. • In order to store a new file, the OS finds the first cluster with a zero pointer entry and enters the cluster number in the directory table. • OS searches linearly for clusters with zero pointer entries to set up the linked list (entering the pointer to the next cluster in the previously used cluster entry in the FAT table).
Speed • Using linear searches will take a long time. • However, the FAT table is normally loaded into RAM so that continual disk accesses can be avoided. • Speeds up the search of the FAT.
Plenary • What is a boot file and a file allocation table (FAT)?
Plenary • A boot file: • A file containing commands to automatically configure a personal computer on start up. • A file allocation table (FAT): • A list held on disk by an operating system to maintain and manage disk space used for file storage.
Plenary • How does a PC operating system use a file allocation table to store and find files when necessary?
Plenary • The disk surface must be divided up into small areas. • Files are stored in these small areas. • Each file will normally use more than one area • The table of files has an entry pointing to the first area on the disk surface used by that file and a pointer to the next area. • Each subsequent area has a pointer to the next area, as in a linked list with a null value to signify the end of the file.