OS_QUIZ-1-REVIEWER.pdf
Document Details
Uploaded by EducatedDada
Polytechnic University of the Philippines
Tags
Full Transcript
OPERATING SYSTEM BSIT 2-1 | FIRST SEMESTER | QUIZ 1 OPERATING SYSTEM FUNCTIONS OF OPERATING SYSTEM ❖ An operating system (OS) is a collection a. Memory Management of software that manages computer Memory...
OPERATING SYSTEM BSIT 2-1 | FIRST SEMESTER | QUIZ 1 OPERATING SYSTEM FUNCTIONS OF OPERATING SYSTEM ❖ An operating system (OS) is a collection a. Memory Management of software that manages computer Memory management refers to management of hardware resources and provides Primary Memory or Main Memory. common services for computer programs. Main memory is a large array of words or bytes ❖ The operating system is a vital where each word or byte has its own address. component of the system software in a computer system. Main memory provides a fast storage that can be accessed directly by the CPU. Operating systems can be viewed from two viewpoints: For a program to be executed, it must in the main memory. An Operating System does the a.) In the resource-manager view, the following activities for memory management operating system’s job is to manage the different parts of the system efficiently. ❖ Keeps tracks of primary memory, i.e., what part of it are in use by whom, b.) In the extended-machine view, the job of what part are not in use. the system is to provide the users with ❖ In multiprogramming, the OS decides abstractions that are more convenient to which process will get memory when use than the actual machine. These include and how much. processes, address spaces, and files. ❖ Allocates the memory when a process requests it to do so. ❖ An operating system is a program that ❖ De-allocates the memory when a acts as an interface between the user process no longer needs it or has been and the computer hardware and terminated. controls the execution of all kinds of programs. b. Processor Management In multiprogramming environment, the OS decides which process gets the processor when and for how much time. This function is called process scheduling. An Operating System does the following activities for processor management − ❖ Keeps tracks of processor and status of process. The program responsible for this task is known as traffic controller. ❖ Allocates the processor (CPU) to a process. ❖ De-allocates processor when a process is no longer required. OPERATING SYSTEM BSIT 2-1 | FIRST SEMESTER | QUIZ 1 c. Device Management d. Error detecting aids − Production of dumps, traces, error messages, and other An Operating System manages device communication via their respective drivers. debugging and error detecting aids. It does the following activities for device e. Coordination between other software and management − users − Coordination and assignment of compilers, interpreters, assemblers and other ❖ Keeps tracks of all devices. Program software to the various users of the computer responsible for this task is known as the systems. I/O controller. ❖ Decides which process gets the device when and for how much time. GOALS OF THE OPERATING SYSTEM ❖ Allocates the device in the efficient way. ❖ De-allocates devices. Primary Goal: The primary goal of an Operating System is to provide a user-friendly and d. File Management convenient environment. We know that it is not A file system is normally organized into compulsory to use the Operating System, but directories for easy navigation and usage. things become harder when the user has to perform all the process scheduling and These directories may contain files and other converting the user code into machine code is directions. also very difficult. So, we make the use of an An Operating System does the following Operating System to act as an intermediate activities for file management − between us and the hardware. All you need to do is give commands to the Operating System ❖ Keeps track of information, location, and the Operating System will do the rest for uses, status etc. The collective facilities you. So, the Operating System should be are often known as file system. convenient to use. ❖ Decides who gets the resources. ❖ Allocates the resources. Secondary Goal: The secondary goal of an ❖ De-allocates the resources. Operating System is efficiency. The Operating System should perform all the management of Other Functions of Operating Systems resources in such a way that the resources are a. Security − By means of password and similar fully utilized, and no resource should be held other techniques, it prevents idle if some request to that resource is there at that instant of time. unauthorized access to programs and data. b. Control over system performance − Recording delays between request for a TYPES OF OPERATING SYSTEM service and response from the system. Batch operating system c. Job accounting − Keeping track of time and ❖ The users of a batch operating system resources used by various jobs and do not interact with the computer directly. Each user prepares his job on users. an off-line device like punch cards and OPERATING SYSTEM BSIT 2-1 | FIRST SEMESTER | QUIZ 1 submits it to the computer operator. To Avoids duplication of software. speed up processing, jobs with similar Reduces CPU idle time. needs are batched together and run as a group. The programmers leave their Disadvantages of Time-sharing programs with the operator and the operating systems are as follows – operator then sorts the programs with Problem of reliability. similar requirements into batches. Question of security and integrity of user programs and data. The problems with Batch Systems are: Problem of data communication. ❖ Lack of interaction between the user Distributed operating System and the job. ❖ CPU is often idle, because the speed of ❖ Distributed systems use multiple central the mechanical I/O devices is slower processors to serve multiple real-time than the CPU. applications and multiple users. Data ❖ Difficult to provide the desired priority. processing jobs are distributed among ❖ the processors accordingly. ❖ The processors communicate with one Time-sharing operating systems another through various ❖ Time-sharing is a technique which communication lines (such as high- enables many people, located at various speed buses or telephone lines). These terminals, to use a particular computer are referred as loosely coupled systems system at the same time. Time-sharing or distributed systems. Processors in a or multitasking is a logical extension of distributed system may vary in size and multiprogramming. Processor's time function. These processors are referred which is shared among multiple users as sites, nodes, computers, and so on. simultaneously is termed as time- The advantages of distributed systems are as sharing. follows – ❖ In Multiprogrammed batch systems, the objective is to maximize processor use, With resource sharing facility, a user at one whereas in Time-Sharing Systems, the site may be able to use the resources available objective is to minimize response time. at another. ❖ The operating system uses CPU scheduling and multiprogramming to Speedup the exchange of data with one provide each user with a small portion another via electronic mail. of a time. Computer systems that were If one site fails in a distributed system, the designed primarily as batch systems remaining sites can potentially continue have been modified to time-sharing operating. systems. Better service to the customers. Advantages of Timesharing operating Reduction of the load on the host computer. systems are as follows – Provides the advantage of quick Reduction of delays in data processing. response. OPERATING SYSTEM BSIT 2-1 | FIRST SEMESTER | QUIZ 1 Network operating System Real Time operating System ❖ A Network Operating System runs on a ❖ A real-time system is defined as a data server and provides the server the processing system in which the time capability to manage data, users, interval required to process and groups, security, applications, and other respond to inputs is so small that it networking functions. The primary controls the environment. The time purpose of the network operating taken by the system to respond to an system is to allow shared file and printer input and display of required updated access among multiple computers in a information is termed as the response network, typically a local area network time. So, in this method, the response (LAN), a private network or to other time is very less as compared to online networks. processing. ❖ Examples of network operating systems include Microsoft Windows Server Two types of real-time operating 2003, Microsoft Windows Server 2008, systems. UNIX, Linux, Mac OS X, Novell NetWare, and BSD. a. Hard real-time Systems The advantages of network operating systems Hard real-time systems guarantee that are as follows – critical tasks complete on time. In hard realtime systems, secondary storage is Centralized servers are highly stable. limited or missing, and the data is Security is server managed. stored in ROM. In these systems, virtual memory is almost never found. Upgrades to new technologies and hardware can be easily integrated into the system. b. Soft real-time systems Remote access to servers is possible from different locations and types of systems. Soft real-time systems are less restrictive. A critical real-time task gets The disadvantages of network operating priority over other tasks and retains the systems are as follows – priority until it completes. Soft real-time High cost of buying and running a server. systems have limited utility than hard real-time systems. For example, Dependency on a central location for most multimedia, virtual reality, Advanced operations. Scientific Projects like undersea Regular maintenance and updates are exploration and planetary rovers, etc required. OPERATING SYSTEM BSIT 2-1 | FIRST SEMESTER | QUIZ 1 HISTORY OF OPERATING SYSTEM Because of these, microcomputers were much cheaper than minicomputers and that made it The First Generation (1945 - 1955): Vacuum possible for a single individual to own one of Tubes and Plugboards them. ❖ Digital computers were not constructed ❖ The advent of personal computers also until the second world war. Calculating led to the growth of networks. This engines with mechanical relays were created network operating systems and built at that time. However, the distributed operating systems. The users mechanical relays were very slow and were aware of a network while using a were later replaced with vacuum tubes. network operating system and could log These machines were enormous but in to remote machines and copy files were still very slow. from one machine to another. ❖ The ENIAC (Electronic Numerical ❖ In 1971 Richard Matthew Stallman Integrator and Computer) was built by (RMS) joined MIT. At that time, all the William Mauchley and his graduate programmers used to share their code student J. Presper Eckert. ENIAC is the freely. first Electronic General-Purpose ❖ In 1980, software companies refused to computer. share the code (copyright). ❖ These early computers were designed, ❖ In 1985, in response, Stallman, founded built and maintained by a single group the Free Software Founda- tion (FSF) of people. Programming languages were and published the GNU manifesto. unknown and there were no operating ❖ Outlined his motivation for creating a systems so all the programming was free OS (GNU), which would be done in machine language. All the compatible with Unix. problems were simple numerical calculations. ❖ By the 1950’s punch cards were The Fifth Generation (1990–Present): introduced and this improved the Mobile Computers computer system. Instead of using plugboards, programs were written on ❖ The period of fifth generation is cards and read into the system. 1980-till date. In the fifth generation, VLSI technology became The Second Generation (1955 - 1965): ULSI (Ultra Large Scale Integration) Transistors and Batch Systems technology, resulting in the The Third Generation (1965–1980): ICs and production of microprocessor chips Multiprogramming having ten million electronic components. The Fourth Generation (1980–Present): ❖ This generation is based on parallel Personal Computers processing hardware and AI Personal Computers were easy to create with (Artificial Intelligence) software. AI the development of largescale integrated is an emerging branch in computer circuits. These were chips containing thousands science, which interprets the means of transistors on a square centimeter of silicon. and method of making computers OPERATING SYSTEM BSIT 2-1 | FIRST SEMESTER | QUIZ 1 think like human beings. All the high-level languages like C and C++, Java,.Net etc., are used in this generation. AI includes – Robotics Neural Networks Game Playing Development of expert systems to make decisions in real-life situations Natural language understanding and generation The main features of fifth generation are – ULSI technology Development of true artificial intelligence Development of Natural language processing Advancement in Parallel Processing Advancement in Superconductor technology More user-friendly interfaces with multimedia features Availability of very powerful and compact computers at cheaper rates Some computer types of this generation are --- Desktop Laptop NoteBook UltraBook ChromeBook OPERATING SYSTEM BSIT 2-1 | FIRST SEMESTER | QUIZ 1 STRUCTURE OF COMPUTER SYSTEM Basic Elements of a Computer ❖ A computer system can be divided ❖ At a top level, a computer consists of roughly into four components: the processor, memory, and I/O hardware, the operating system, the components, with one or more modules application programs, and the users. of each type. These components are interconnected in some fashion to achieve the main function of the computer, which is to execute programs. Thus, there are four main structural elements: 1. Processor: Controls the operation of the computer and performs its data processing functions. When there is only one processor, it is often referred to as the central processing unit (CPU). 2. Main memory: Stores data and programs. This memory is typically volatile; that is, when the computer is Four Components: shut down, the contents of the memory 1. Hardware – provides basic computing are lost. In contrast, the contents of disk resources e.g. CPU, memory, I/O devices memory are retained even when the computer system is shut down. Main 2. Operating system - Controls and coordinates memory is also referred to as real use of hardware among various applications and memory or primary memory users 3. I/O modules: Move data between 3. Application programs – define the ways in the computer and its external which the system resources are used to solve environment. The external environment the computing problems of the users. e. g. Word consists of a variety of devices, processors, compilers, web browsers, database including secondary memory devices systems etc… (e.g., disks), communications equipment, and terminals. 4. Users e.g. People, machines, other computers 4. System bus: Provides for We can also view a computer system as communication among processors, consisting of hardware, software, and data. The main memory, and I/O modules. operating system provides the means for proper use of these resources in the operation of the Computer Startup (Bootup) computer system. An operating system is similar to a government. Like a government, it performs Bootstrap program is loaded at power-up or no useful function by itself. It simply provides an reboot environment within which other programs can Typically stored in ROM or EPROM, generally do useful work. known as firmware Initializes all aspects of system OPERATING SYSTEM BSIT 2-1 | FIRST SEMESTER | QUIZ 1 Loads operating system kernel and starts There are 2 kinds of interrupts; execution. 1. Synchronous interrupts often called ---------------------------------------------------------- exceptions. [Generated by the CPU] ▪ Every PC contains a parentboard 2. Asynchronous interrupts often called (formerly called motherboard). interrupts. [Generated by other Hardware ▪ The parentboard has the system BIOS devices] (Basic Input/Output System). -External interrupt: issued by peripheral devices. ▪ The BIOS handles low-level I/O tasks, -Trap: It is also called exception handling such as such as reading the keyboard and ‘divide by zero’, ‘segmentation faults’, ‘page writing to the screen. faults’ and ‘system calls’. (trap is called also ▪ It is stored in flash RAM, which can be ‘software interrupt) -Interrupts and Traps are all updated by the operating system. handled in the same way at Linux. ▪ During boot, the BIOS checks the installed RAM and basic devices. Classes of Interrupts ▪ It scans PCIe and PCI buses to detect connected devices and configures new 2. Program - Generated by some condition that ones. occurs as a result of an instruction execution, ▪ The boot device is determined from a such as arithmetic overflow, division by zero, list in CMOS memory, which users can attempt to execute an illegal machine change. instruction, and reference outside a user's ▪ The system typically attempts to boot allowed memory space. from a CD-ROM or USB drive; if that 3. Timer - Generated by a timer within the fails, it boots from the hard disk. processor. This allows the operating system to ▪ The first sector from the boot device is perform certain functions on a regular basis. read, which examines the partition table for the active partition. 4. I/O - Generated by an I/O controller, to signal ▪ A secondary boot loader reads the normal completion of an operation or to signal a operating system and starts it. variety of error conditions. ▪ The OS queries the BIOS for 5. Hardware – Generated by a failure, such as configuration and loads necessary power failure or memory parity error. device drivers. ▪ If drivers are missing, the OS prompts the user to provide them via CD-ROM or I/O Structure the Internet. ▪ After loading the drivers, the OS ❖ The controlling of various devices that initializes and starts background are connected to the computer is a key processes and a login program or GUI. concern of operating-system designers. This is because I/O devices vary so widely in their functionality and speed Traps and Interrupts (for example a mouse, a hard disk and a CD-ROM), varied methods are required Interrupt for controlling them. These methods OPERATING SYSTEM BSIT 2-1 | FIRST SEMESTER | QUIZ 1 form the I/O sub-system of the kernel of The data registers are usually 1 to 4 bytes in OS that separates the rest of the kernel size. Some of the controllers have FIFO chips from the complications of managing I/O which hold several bytes of input or output data devices. for expanding the capacity of the controller beyond the size of the data register. I/O Hardware Storage Structure ❖ Computers operate many huge kinds of devices. The general categories of The computer storage devices include Primary storage devices are like disks, tapes, and Secondary Storage devices. These are transmission devices (like network explained in detail as follows interface cards, modems) and human interface devices (like screen, keyboard, etc.). ❖ A device communicates with the operating system of a computer by transferring signals over cable or even through the air. The peripheral devices communicate with the machine through a connection point also called ports— Primary Storage Devices - also known as the (one example is a serial port). When main memory and is the memory directly devices use a set of wires or cables, that accessible by the CPU. connecting cables are called a "bus." A bus is a collection of wires and a firmly Some primary storage devices are defined protocol which specifies a set of a. ROM or Read Only Memory - This memory messages that can be sent on the wires. cannot be changed, it can only be read as Operating System Using I/O Port required. Since ROM is unchangeable memory, it is used by data and programs that are An I/O port usually consists of four different frequently required and seldom changed, like registers. These are (1) status, (2) control, (3) the system boot program. data-in, and (4) data-out registers. b. RAM or Random Access Memory. -It is The data-in register is read by the host for volatile i.e. the data in RAM is lost when the getting input. power is switched off. RAM is the major form of The data-out register is written by the host for primary memory as it is quite fast. However, it is sending output. also quite expensive. The status register holds bits which can be c. Cache – Is used to store data and instructions read by the host. that are frequently required by the CPU so it doesn't have to search them in the main The control register is written by the host for memory. This is a small memory that is also very starting a command or for changing the mode fast. of any device. Secondary Storage Devices or external storage is not directly accessible by the CPU. The data OPERATING SYSTEM BSIT 2-1 | FIRST SEMESTER | QUIZ 1 from secondary storage needs to be brought A byte is 8 bits, and on most computers it is the into the primary storage before the CPU can use smallest convenient chunk of storage. For it. Secondary storage contains a large amount of example, most computers don’t have an data permanently. instruction to move a bit but do have one to move a byte. The different types of secondary storage devices are: A word, which is a given computer architecture’s native unit of data. A word is a. Hard disks - The most famously used made up of one or more bytes. For example, a secondary storage devices. They are round, flat computer that has 64-bit registers and 64-bit pieces of metal covered with magnetic oxide. memory addressing typically has 64-bit (8-byte) They are available in many sizes ranging from 1 words. A computer executes many operations in to 14-inch diameter. its native word size rather than a byte at a time. b. Floppy Disks - They are flexible plastic discs Computer storage, along with most computer which can bend, coated with magnetic oxide throughput, is generally measured and and are covered with a plastic cover to provide manipulated in bytes and collections of bytes. protection. Floppy disks are also known as floppies and diskettes. A kilobyte, or KB, is 1,024 bytes c. Memory Card - This has similar functionality a megabyte, or MB, is 1,0242 bytes to a flash drive but is in a card shape. It can a gigabyte, or GB, is 1,0243 bytes easily plug into a port and removed after its work is done. A memory card is available in a terabyte, or TB, is 1,0244 bytes various sizes such as 8GB, 16GB, 64GB, etc. a petabyte, or PB, is 1,0245 bytes d. Flash Drive - This is also known as a pen drive. It helps in easy transportation of data from one Computer manufacturers often round off these system to another. A pen drive is quite compact numbers and say that a megabyte is 1 million and comes with various features and designs. bytes and a gigabyte is 1 billion bytes. Networking measurements are an exception to e. CD-ROM - This is short for compact disk - this general rule; they are given in bits (because read only memory. A CD is a shiny metal disk of networks move data a bit at a time). silver colour. It is already pre-recorded and the data on it cannot be altered. It usually has a storage capacity of 700 MB. Hardware Protection When executing in monitor mode, the operating Computer Storage Notations system has unrestricted access to both monitor and user’s memory. The load instructions for There are several storage notations. These are the base and limit registers are privileged given in detail as follows: instructions A bit is the smallest unit of memory storage. It Protection – any mechanism for controlling can contain either 0 or 1. All other storage in a access of processes or users to resources computer is based on collections of bits. defined by the OS OPERATING SYSTEM BSIT 2-1 | FIRST SEMESTER | QUIZ 1 Security – defense of the system against internal c. Base register – holds the smallest legal and external attacks. physical memory address. Four types of Hardware Protections d. Limit register – contains the size of the range Memory outside the defined range is protected. 1. Dual-Mode Operation 4. CPU Protection Sharing system resources requires operating system to ensure that an incorrect a. Timer – interrupts computer after specified program cannot cause other programs to period to ensure operating system maintains execute incorrectly. Provide hardware control. support to differentiate between at least b. Timer is decremented every clock tick. two modes of operations. c. When timer reaches the value 0, an interrupt a. User mode – execution done on behalf of a occurs. Timer commonly used to implement user. time sharing. Time also used to compute the b. Monitor mode (also kernel mode or system current time. Load-timer is a privileged mode) – execution done on behalf of operating instruction. system. Mode bit added to computer hardware to indicate the current mode: monitor (0) or user (1). When an interrupt or fault occurs hardware switches to monitor mode. Privileged instructions can be issued only in monitor mode. 2. I/O Protection All I/O instructions are privileged instructions. Must ensure that a user program could never gain control of the computer in monitor mode (I.e., a user program that, as part of its execution, stores a new address in the interrupt vector). 3. Memory Protection Must provide memory protection at least for the interrupt vector and the interrupt service routines. In order to have memory protection, add two registers that determine the range of legal addresses a program may access: