TOPIC 3 OPERATING SYSTEM AND COMPUTER APPLICATION SOFTWARE
Introduction to Operating system An operating system acts as an intermediary between the user of a computer and the computer hardware. The purpose of an operating system is to provide an environment in which a user can execute programs in a convenient and efficient manner. An operating system is software that manages the computer. It must provide appropriate mechanisms to ensure the correct operation of the computer system and to prevent user programs from interfering with the proper operation of the system.
What is operating system? An operating system (OS) is a collection of software that manages computer hardware resources Without a computer operating system, a computer would be useless OS acts as an interface between the user and computer Overview Every general purpose computer consists of the hardware, operating system, system programs, and application programs. The hardware consists of memory, CPU, I/O devices, peripheral device and storage device. System program consists of compilers, loaders, editors, OS etc. The application program consists of business program and database program. Below is a conceptual view of a computer system.
OS is designed to serve two basic purposes/objectives of Operating System : Allocation of resources. It controls the allocation and use of the computing system‘s resources among the various user and tasks, i.e. controls how processes may access the resources. Hide details of hardware by creating abstractions. It provides an interface between the computer hardware and the programmer thus simplifies and makes it feasible for coding, creation, and debugging of application programs.
History of Operating System Operating systems have been evolving through years in generations. 1 st Generation – 1940s The earliest electronic digital computers had no operating system. They were very large and used vacuum tubes. Programs were entered manually one bit at a time and on machine/plug boards. 2 nd Generation – 1950s With the implementations of transistors, operations improved with introduction of punch cards and the operating systems used to run one job at a time and are referred to as single stream batch processing system because data and programs were submitted in forms of batches. 3 rd Generation- 1960s Batch processing systems were also used but with the use of Integrated Circuits (IC) the systems were able to take advantage of computer resources by running several jobs at once. The concept of multiprogramming was developed where several jobs were loaded into memory and the processor could switch from one job to another. Also timesharing technique, a variant of multiprogramming, where each user was directly connected to the system through a terminal, was stimulated. 4 th Generation- 1970s Operating systems of this generation were developed as a result of Very Large Scale Integration (VLSI) circuits. Microprocessor technology evolved to the point that desktop computers as powerful as mainframes were built. Operating systems were developed which dominated the personal computer scene.
Services of an operating system Program execution Operating system with respect to program management does the following; loads a program into memory, executes the program, handles program execution, provides a mechanism for process synchronization, provides a mechanism for process communication, and provides a mechanism for deadlock handling. I/O Operation An operating system with respect to I/O Operation does the following; I/O operation, means read or write operation with any file or any specific I/O, issuance of I/O device to a program while running, and provides the access to the required I/O device when required. File system manipulation Major activities of OS in file management include; Program needs to read a file or write a file and thus the operating system gives the permission to the program for operation on file- Permission varies from read-only, read-write, denied and so on. It provides an interface to the user to create/delete files. It provides an interface to the user to create/delete directories, and it provides an interface to create the backup of file system.
Communication Two processes often require data to be transferred between them and both processes can be on the one computer or on different computers but are connected through computer network. Thus OS may implement communication by two methods, either by Shared Memory or by Message Passing. Error handling OS constantly remains aware of possible errors and takes the appropriate action to ensure correct and consistent computing. Resource Management OS manages all kind of resources using schedulers and CPU scheduling algorithms are used for better utilization of CPU. Protection OS ensures that all access to system resources is controlled, that external I/O devices are protected from invalid access attempts and provides authentication feature for each user by means of a password.
Process coordination Process Control Block (PCB) When a process is being executed, the operating system must store information about a process in a PCB. When scheduler switches CPU from executing one process to another, context switcher saves the contents of all processor registers in process descriptor. That is, the context of a process is represented in a PCB of a process. It contains information about a process such as; Pointer : Pointer points to another process control block. Pointer is used for maintaining the scheduling list. Process State : Process state may be new, ready, running, waiting and so on. Program Counter : It indicates the address of the next instruction to be executed for this process.
Event information : For a process in the blocked state this field contains information concerning the event for which the process is waiting. CPU register : It indicates general purpose registers, stack pointers and index registers. Number of register and type of register totally depends upon the computer architecture. Memory Management Information : This information may include the value of base and limit register. This information is useful for de-allocating the memory when the process terminates. Accounting Information : This information includes the amount of CPU and real time used, time limits, job or process numbers etc.
Concurrent Processes In a single-processor multiprogramming system, processes are interleaved in time to yield the appearance of simultaneous execution. Even though there is a certain amount of overhead involved in switching back and forth between processes, interleaved execution provides benefits in processing efficiency and in program structuring. Concurrent processes (processes executing concurrently) in operating system may either be independent or cooperating processes. A process is independent if it cannot affect or be affected by other processes executing in the system. Any process that that does not share data with any other process is independent. A process is cooperating if it can affect or be affected by other processes executing in the system. Any process that shares data with other processes is a cooperating process. The OS supports concurrency for the following reasons;
Information sharing : Several processes may be interested in the same piece of information (e.g. a shared file) and thus concurrent access to such files must be allowed. Computation speedup : for a particular process to run faster, it is broken into sub-processes (threads) which shall be executed in parallel with each other. Modularity : System functions are divided into separate functions or threads. Convenience : Allowing the CPU to work on several tasks at the same time. Cooperating process usually, however, face two major problems. These problems include; Starvation : A process is made to wait for a resource indefinitely. Deadlock : This occurs when two or more processes block waiting an event to occur which is under the control of the other blocking process. To overcome these two problems then process synchronization must be ensured.
Process Synchronization When two processes are writing or reading some shared data and the final result depends on the order of execution of instructions, i.e. results depends on who runs precisely when, leads to occurrence of a race condition. Suppose two processes P1 and P2 share a global variable B. At some point in execution, P1 updates B to value 1 and at some point in execution P2 updates B to value 2. The two tasks are in a race to write variable B. In this example, the “loser” of the race (process that updates last) determines the final value of B.
The scheduling algorithm must determine the relative timing of cooperating processes. Code executed by a process can be grouped into sections some of which require access to shared resources and others that do not. The section of the code that requires access to shared resources is called a Critical section. To avoid race condition occurring, a mechanism is needed to synchronize execution within critical sections. Mutual exclusion then needs to be satisfied, i.e. when a process is in a critical section that accesses a set of shared resources no other process should be in a critical section at the same time. A process waiting to enter a critical section need to wait a finite time and a process that terminates outside its critical section should not prevent other processes to enter into critical section.
Requirements for mutual exclusion To provide mutual exclusion, the following requirements must be met; Only one process at a time is allowed into its critical section among all processes that have critical sections. A process that stops in its non-critical section must do so without interfering with other processes. A process requiring access to a critical section should not be delayed indefinitely to starvation or deadlock. When no process is in its critical section, any process that request entry must be permitted to enter its critical section without delay. A process must remain inside its critical section for a finite time only.
Methods of handling mutual exclusion Use of hardware solution by interrupt disabling : Each process that is entering in its critical section disables all interrupts before entering in its critical section. With interrupt disabled the CPU cannot be switched to other processes. Use of software solution by using tests and set instructions : In this method, mutual exclusion is achieved when a process that wants to enter in its critical section first tests a lock. If a lock is 0 it means that no process is in critical process. Then the process sets the lock to 1 and now enters in critical section. If the lock is already 1, the process just wait until the lock variable becomes 0. Use of semaphore : This was proposed by Dijkstra in 1965. A semaphore is a simple integer variable which can take non-negative values and upon which two operations called wait and signal are defined. Entry into critical section is controlled by wait operation and exit from critical section by signal operation. If a semaphore has a non-zero value this indicates the availability of resource whereas if else is zero, the resource is not available. Assuming S is the variable
Wait (S) If S > 0 // resource is available Set S to S – 1 Else if S = 0 // resource is not available //block the calling process (waits) Else Set S to S + 1 // release the resource
Use of monitors : Semaphore provide general purpose solution for controlling access to critical section but this does not guarantee mutual exclusion on deadlock. A monitor is a programming language construct that guarantees appropriate access to critical sections. This code is placed before and after critical sections to control access to critical section and is generated by the compiler. Inside the monitor is a collection of uninitialized code, shared data objects and functions. Processes that may wish to access shared data object must do so through the execution of monitor functions. A process enters into the monitor by invoking one of its procedures. If a process is executing in the monitor then no other process is allowed to invoke the monitor but it is suspended until the monitor becomes available. Wait operation suspends process invokement and the Signal operation allows a waiting process to re-enter the monitor at the point its execution was suspended.
Inter-Process Communication Processes need to communicate with each other for the purposes of information sharing and files are the mechanism for information sharing. Information written to a file by one process can be read by another. This information that can be shared is limited by file capacity of the file system. Many operating system support an explicit system for sending messages between processes. A Message is a collection of data objects consisting of a fixed size header and a variable or constant length body which can be managed by a process and delivered to its destination. There are two fundamental models of inter-process communication, namely; Shared memory and Message passing.
Shared memory: In this model, a region of memory that is shared by cooperating processes is established. Typically, a shared-memory region resides in the address space of the process creating the shared-memory segment. Other processes that wish to communicate using this shared-memory segment must attach it to their address space. Recall that, normally, the operating system tries to prevent one process from accessing another process's memory. Shared memory requires that two or more processes agree to remove this restriction. They can then exchange information by reading and writing data in the shared areas. The form of the data and the location are determined by these processes and are not under the operating system's control. The processes are also responsible for ensuring that they are not writing to the same location simultaneously. Shared memory allows maximum speed and convenience of communication, as it can be done at memory speeds when within a computer Message Passing: communication takes place by means of messages exchanged between the cooperating processes. Message passing provides a mechanism to allow processes to communicate and to synchronize their actions without sharing the same address space and is particularly useful in a distributed environment, where the communicating processes may reside on different computers connected by a network. A message-passing facility provides at least two operations: send (message) and receive (message). Message passing is useful for exchanging smaller amounts of data, because no conflicts need be avoided. It is also easier to implement than is shared memory for inter-computer communication.
File management File System and File System Organization For most users, the file system is the most visible aspect of an operating system. It provides the mechanism for on-line storage of and access to both data and programs of the operating system and all the users of the computer system. In definition, a File system is the sub-system of the operating system that provides services to users and applications in the use of files. The file system consists of two distinct parts: a collection of files , each storing related data, and a directory structure , which organizes and provides information about all the files in the system. A file system is normally organized into directories for easy navigation and usage. These directories may contain files and other directories. In respect to file management, the operating system performs the following activities; Keeps track of information, location, uses, status etc. The collective facilities are often known as file system. Decides who gets the resources (files). Allocates the resources (files) to both programs and users. De-allocates the resources (files) to both programs and users of the computer system.
File concept Computers store information on various storage media such as magnetic disks, magnetic tapes and optical disks. To allow convenient usage of a computer system, the operating system provides a uniform logical view of stored information. The operating system abstracts the physical storage devices to define a logical storage unit, which is the file. Files are mapped by the operating system onto physical devices which are usually non-volatile, meaning the contents are persistent between computer reboots. A File is a named collection of related information that is recorded on secondary storage. From user’s perspective, a file is the smallest allotment of logical secondary storage, i.e. data cannot be written to secondary storage unless they are within a file. Information stored in a file is defined by the creator of the file and such information may be of different types, which may include, source or executable programs, numeric or text data, music, videos, photos etc. Depending on the type of a file, files have certain defined structures. For example: A text file is sequence of characters organized into lines (and possibly pages). A source file is a sequence of functions, each of which is further organized as declarations followed by executable statements. An executable file is a series of code sections that the loader can bring into memory and execute.
The purpose of file is to hold data required for providing information and therefore, files can be viewed as logical and physical files. A Logical file is a file viewed in terms of what data items its records contain and what processing operations may be performed on the file. A Physical file is a file viewed in terms of how the data is stored on storage device such as magnetic disc and how processing operations are made possible. File attributes For the convenience of human users, each file is given a specific name and therefore, a file is referred to by its name. A name is usually a string of characters, e.g., example.doc. Once a file is named, it becomes independent of the process, the user, and even the system that created it. For example, one user might create a file example.doc and another user might edit that file by specifying its name. The file owner might write the same file to a USB disk, copy it, send it across a network and it could be still called example.doc on the destination system. File attributes vary from one operating system to another but typically a file consists: Name: the symbolic file name is the only information kept in human readable form. Identifier: this unique tag, usually a number, identifies the file within the file system; it’s a non-human readable name of file. Type: this information is needed for systems that support different types of files. Location: this information is a pointer to a device and to the location of the file on that device. Size: the current size of the file (in bytes, words, or blocks) and possibly the maximum allowed size are included in this attribute. Protection: access-control information determines who can do reading, writing, executing, and so on. Time, date and user identification: this information may be kept for creation, last modification and last use. These data can be useful for protection, security and usage monitoring.
File Operations Any file system provides not only a means to store data organized as files, but a collection of functions that can be performed on files. Typical operations include: Create: A new file is defined and positioned within the file system. Two necessary steps involved for this operation. First, a space in the file system must be found for the file. Second, an entry for the new file must be made in the directory. Write: a process updates a file, either by adding new data that expands the size of the file or by changing the values of existing data items in the file. Usually a system call is made specifying both the name of file and the information to be written to that file. Read: a process reads all or portion of the data in a file. To read from a file a system call is made specifying the name of file and where (in memory) the next block of the file should be put. Delete: A file is removed from the file structure and destroyed. Here the directory is searched for the named file. Once found, all file space is released so that other files can reuse the space. Lastly, the directory entry of that file is erased. Reposition: this involves moving a file from one directory to another or a different location in the storage device. Usually, the directory is searched for the appropriate entry and the current file position pointer is repositioned to a given value. Truncate: The user may want to erase the contents of a file but keep its attributes. Rather than deleting the file and recreating it afresh, this operation allows all attributes to remain unchanged – except for file length – but lets the file be reset to length zero and its file space released. Other common operations include append, where new information is added to the end of an existing file and rename where an existing file is given another name. Most of the operations mentioned involve searching the directory for entry associated with the named file. To avoid constant searching, many systems require that open system call be made before a file is first used. The operating system keeps a table, called the open-file table, containing information about all open files. When the file is no longer being actively used, it is closed using close system call where the operating system removes its entry from open-file table.
File Access Methods When the information stored in file is used, that information must be accessed and read into computer memory. There are several ways for accessing this information and choosing the right method for a particular application poses the major design problem. Sequential access This is the simplest access method in which, information in the file is processed in order, one record after the other. This method of access is by far the most common. For example, editors and compilers usually access files in this fashion. Indexed sequential access This mechanism is built upon the base of sequential access. An index is created for each file. Index contains pointer to a block. To find a record in the file, the index is first searched and then the pointer is used to access the file directly and to find the desired record. NB: index is searched sequentially and its pointer is used to access the file directly. Direct access This method is also referred to as relative access. In this method, a file is made up of fixed-length logical records that allow programs to read and write records rapidly in no particular order. A file is viewed as a numbered sequence of blocks or records. As a result, there are no restrictions on the order of reading or writing for this method of access. Direct access files are of great use for immediate access to large amounts of information. A good example is a database in which, when a query concerning a particular subject arrives, the block containing the answer is computed and then that block is read directly to provide the desired information.
Directory structure organization There are typically thousands, millions, and even billions of files within a computer which are stored on random access storage devices. Files are usually segregated into groups which are easier to manage and act upon. This organization involves the use of directories. A directory contains a set of files or subdirectories. In modern operating systems, directories are tree-structured which allow users to create their own subdirectories and to organize their files accordingly. In this tree structure, the tree has a root directory and every file in the system has a unique path name. A path name is defined by the user name and a file name. In normal use, each process has a current directory, i.e. the directory containing most of the files that are of current interest to the process. When reference is made to a file, the current directory is searched. If a needed file is not in the current directory, then the user must either specify a path name or change the current directory to be the directory holding that file. Path names can be of two types: absolute and relative. An absolute path name begins at the root and follows a path down to the specified file, giving the directory names on the path. A relative path name defines a path from the current directory. For example, consider the figure below
Operations of OS Start and shut down a computer Coordinate tasks Establish an internet connection Provide a user interface Configure devices Control network Manage programs Manage memory Provide utilities
Features of an operating system Protected and supervisor mode Allows disk access and file systems Device drivers Networking Security Program Execution Memory management Virtual Memory Multitasking Handling I/O operations Manipulation of the file system Error Detection and handling Resource allocation Information and Resource Protection Multitasking Multithreading Multiprocessing
Types of operating systems Batch Operating System Multitasking/Time Sharing OS Multiprocessing OS Real Time OS Distributed OS Network OS Mobile OS
Batch Operating System Some computer processes are very lengthy and time-consuming. To speed the same process, a job with a similar type of needs are batched together and run as a group. Multi-Tasking/Time-sharing Operating systems Time-sharing operating system enables people located at a different terminal(shell) to use a single computer system at the same time. The processor time (CPU) which is shared among multiple users is termed as time sharing. Real time OS A real time operating system, time interval to process and respond to inputs is very small. Examples: Military Software Systems, Space Software Systems. Distributed Operating System Distributed systems use many processors located in different machines to provide very fast computation to its users. Network Operating System Network Operating System runs on a server. It provides the capability to serve, to manage data, user groups, security, application, and other networking functions. Mobile OS Mobile operating systems are those OS which are designed to power smartphones, tablets, etc Some most famous mobile operating systems are Android and iOS, but others include BlackBerry, Web, and watch OS.
Difference between Firmware and Operating System Firmware Operating System Firmware is one kind of programming that is embedded on a chip in the device which controls that specific device. OS provides functionality over and above that which is provided by the firmware. Firmware is programs that has been encoded by the manufacture of the IC or something and cannot be changed. OS is a program that can be installed by the user and can be changed. It is stored on non-volatile memory. OS is stored on the hard drive.
Difference between 32-Bit vs. 64 Bit Operating System Parameters 32. Bit 64. Bit Architecture and Software Allow 32 bit of data processing simultaneously Allow 64 bit of data processing simultaneously Compatibility 32-bit applications require 32-bit OS and CPUs. 64-bit applications require a 64-bit OS and CPU. Systems Available All versions of Windows 8, Windows 7, Windows V`ista , and Windows XP, Linux, etc. Windows XP Professional, Vista, 7, Mac OS X and Linux. Memory Limits 32-bit systems are limited to 3.2 GB of RAM. 64-bit systems allow a maximum 17 Billion GB of RAM.
The advantage of using Operating System Allows you to hide details of hardware by creating an abstraction Easy to use with a GUI Offers an environment in which a user may execute programs/applications The operating system must make sure that the computer system is convenient to use Operating System acts as an intermediary among applications and the hardware components It provides the computer system resources with easy to use format Acts as an intermediator between all hardware's and software's of the system
Disadvantages of using Operating System If any issue occurs in OS, you may lose all the contents which have been stored in your system Operating system's software is quite expensive for small size organization which adds burden on them. Example Windows It is never entirely secure as a threat can occur at any time
Function of operating system Process management :- Process management helps OS to create and delete processes. It also provides mechanisms for synchronization and communication among processes. Memory management:- Memory management module performs the task of allocation and de-allocation of memory space to programs in need of this resources. File management :- It manages all the file-related activities such as organization storage, retrieval, naming, sharing, and protection of files.
Device Management : Device management keeps tracks of all devices. This module also responsible for this task is known as the I/O controller. It also performs the task of allocation and de-allocation of the devices. I/O System Management: One of the main objects of any OS is to hide the peculiarities of that hardware devices from the user. Secondary-Storage Management : Systems have several levels of storage which includes primary storage, secondary storage, and cache storage. Instructions and data must be stored in primary storage or cache so that a running program can reference it. Security :- Security module protects the data and information of a computer system against malware threat and authorized access. Command interpretation : This module is interpreting commands given by the and acting system resources to process that commands.
Networking: A distributed system is a group of processors which do not share memory, hardware devices, or a clock. The processors communicate with one another through the network. Job accounting : Keeping track of time & resource used by various job and users. Communication management : Coordination and assignment of compilers, interpreters, and another software resource of the various users of the computer systems. Booting: Booting is a process of starting the computer operating system starts the computer to work. It checks the computer and makes it ready to work. Loading and Execution: A program is loaded in the memory before it can be executed. Operating system provides the facility to load programs in memory easily and then execute it.
Kernel The kernel is the central component of a computer operating systems. The only job performed by the kernel is to the manage the communication between the software and the hardware. A Kernel is at the nucleus of a computer. It makes the communication between the hardware and software possible. While the Kernel is the innermost part of an operating system, a shell is the outermost one.
Features of Kennel Low-level scheduling of processes Inter-process communication Process synchronization Context switching Types of Kernels There are many types of kernels that exists, but among them, the two most popular kernels are: Monolithic and Microkernels
Features of application software They include; Word processing Spreadsheets Database programs Presentation program
Word processing Word processing software sometimes called a word processor, allows users to create and manipulate documents containing mostly text and sometimes graphics Millions of people use word processing software everyday to develop documents such as letters, memos, report, mailing labels, newsletters and web pages
Spreadsheet software Spreadsheet software allows users to organize data in rows and columns and perform calculations on the data. These rows and columns collectively are called a worksheet Because of spreadsheet software’s logical approach to organizing data, many people use this software to organize and present nonfinancial data, as well as financial data
Database software A database is a collection of data organized in a manner that allows access, retrieval and use of that data. In a manual database, you might record data on paper and store it in a filling cabinet Database software is application software that allows users to create, access, and manage a database. Using database software, you can add, change, and delete data in a database; sort and retrieve data from the database; and create forms and reports using the data in the database
Presentation software Presentation software is application software that allows users to create visual aids for presentations to communicate ideas, messages, and information to a group The presentations can be viewed as slides, sometimes called a slide show, that are displayed on a large monitor or on a projection screen
Choice of appropriate software 1. COMPATIBILITY Integration and compatibility are key. If a solution doesn’t play nice with your current setup, it’s probably not worth your time. 2. FUNCTIONALITY Does it work? The sole purpose of software and automation is to free up our manpower to focus on things that require more creativity and involve less drudgery. If the solution need a lot of engineering time to setup and build features, a closer look needs to be taken on whether the invested extra time is going to be worth the benefits. 3. PRICE The next and arguably most important factor is the price. How much a solution costs is just part of the picture, how much it costs in comparison to your current solution will tell you whether it’s going to be saving you money or not. A lot of people on a strict budget might want to look at price before anything else since if something’s outside the budget, there’s no point wasting time with it. In contrast, people with a more flexible budget feel price isn’t the most important factor. 4. CREDIBILITY If respectable companies are already using the solutions you’re about to buy, that’s a major positive sign for you. It’s also good to look at companies similar to yours that the vendor has worked with in the past, this could be a good indicator of whether the solution will be good for you or not.
5. USER FRIENDLINESS If everything has checked out so far, it’s time to get your hands on the software or get your engineer’s hands on the software to figure out just how easy it is to use. If a particular tool is too hard to use or requires your engineers to develop additional skills just to use it, you’re probably better off looking elsewhere. 6. AGILITY Agility is next on our list and agility comes from innovation. Selecting a vendor is like selecting a partner and you want someone who’s willing to change and innovate in order to stay relevant. Look for a company’s latest updates, see what servers they use, check if they’re using the latest technology like containers or AI and look for how flexible they are with regards to change and innovation. 7. EXIT STRATEGY Last but not least, it’s probably a good idea to always have a clear exit strategy in case you outgrow a certain solution.