OS ASSIGNMENT-1 Q1. In a multiprogramming and time-sharing environment, several users share the system simultaneously. This situation can result in various security problems. a. What are two such problems? b. Can we ensure the same degree of security in a time-shared machine as in a dedicated machine? Explain your answer? Ans1: (a) Stealing or copying a user’s files; writing over another program’s (belonging to another user or to the OS) area in memory; using system resources (CPU, disk space) without proper accounting; causing the printer to mix output by sending data while some other user’s file is printing. (b) Probably we cannot assure the same degree of security in a time shared machine as in a dedicated machine, since any protection scheme devised by a human can also be broken — and the more complex the scheme is, the more difficult it is to be confident of its correct implementation. Q2. Which of the functionalities listed below need to be supported by the operating system for the following two settings: (a) handheld devices and (b) real-time systems? a. Batch programming b. Virtual memory c. Time sharing Ans2: For hand held systems, the operating system needs to provide virtual memory, but does not need to provide time-sharing. For real-time systems, the operating system needs to support virtual memory and time sharing in a fair manner. Batch programming is not necessary in both settings. Q3. Describe the differences between symmetric and asymmetric multiprocessing. What are three advantages and one disadvantage of multiprocessor systems? Ans3: Symmetric processing treats all processors as equals; I/O can be processed on any of them. Asymmetric processing designates one CPU as the master, which is the only one capable of performing I/O; the master distributes computational work among the other CPUs. Advantages |Disadvantage | |Multiprocessor systems can save money, by sharing power supplies, |Multiprocessor systems are more complex in both hardware and | |housings, and peipherals. |software. | |Can execute programs more quickly. |Additional CPU cycles are required to manage the cooperation, so | | |per-CPU efficiency goes down. | |Can have increased reliability. | | Q4. How do clustered systems differ from multiprocessor systems? What is required for two machines belonging to a cluster to cooperate to provide a highly available service? Ans4: |Clustered Systems |Multiprocessor Systems | |Clustered systems are typically constructed by combining multiple |Multiprocessor systems on the other hand could be a single | |computers into a single system to perform a computational task |physical entity comprising of multiple CPUs. | |distributed across the cluster. | | |It is less tightly coupled. It is tightly coupled. | |Clustered systems communicate using messages. |While processors in a multiprocessor system could communicate | | |using shared memory | | | | Q5: Define the essential properties of the following types of operating systems: a. Batch b. Interactive c. Time sharing d. Real time e. Network f. Parallel g. Distributed h. Clustered i. Handheld Ans5: a. Batch. Jobs with similar needs are batched together and run through the computer as a group by an operator or automatic job sequencer. Performance is increased by attempting to keep CPU and I/O devices busy at all times through buffering, off-line operation, spooling, and multiprogramming. Batch is good for executing large jobs that need little interaction; it can be submitted and picked up later. b. Interactive. This system is composed of many short transactions where the results of the next transaction may be unpredictable. Response time needs to be short (seconds) since the user submits and waits for the result. c. Time sharing. This systems uses CPU scheduling and multiprogramming to provide economical interactive use of a system. The CPU switches rapidly from one user to another. Instead of having a job defined by spooled card images, each program reads its next control card from the terminal, and output is normally printed immediately to the screen. d. Real time. Often used in a dedicated application, this system reads information from sensors and must respond within a fixed amount of time to ensure correct performance. . Network. Provides operating system features across a network such as file sharing. f. SMP. Used in systems where there are multiple CPU’s each running the same copy of the operating system. Communication takes place across the system bus. g. Distributed. This system distributes computation among several physical processors. The processors do not share memory or a clock. Instead, each processor has its own local memory. They communicate with each other through various communication lines, such as a high-speed bus or local area network. h. Clustered. A clustered system combines multiple computers into a single system to perform computational task distributed across the cluster. i. Handheld. A small computer system that performs simple tasks such as calendars, email, and web browsing. Handheld systems differ from traditional desktop systems with smaller memory and display screens and slower processors. Q6. List ? ve services provided by an operating system that are designed to make it more convenient for users to use the computer system. In what cases it would be impossible for user-level programs to provide these services? Explain Ans6: a. Program execution. The operating system loads the contents (or sections) of a file into memory and begins its execution. A user level program could not be trusted to properly allocate CPU time. b. I/O operations. Disks, tapes, serial lines, and other devices must be communicated with at a very low level. The user need only specify the device and the operation to perform on it, while the system converts that request into device- or controller-specific Commands. User-level programs cannot be trusted to access only devices they should have access to and to access them only when they are otherwise unused. . File-system manipulation. There are many details in file creation, deletion, allocation, and naming that user should not have to perform. Blocks of disk space are used by files and must be tracked. Deleting a file requires removing the name file information and freeing the allocated blocks. Protections must also be checked to assure proper file access. User programs could neither ensure adherence to protection methods nor be trusted to allocate only free blocks and reallocate blocks on file deletion. d. Communications. Message passing between systems requires messages to be turned into packets of information, sent to the network controller, transmitted across a communications medium, and reassembled by the destination system. Packet ordering and data correction must take place. Again, user programs might not coordinate access to the network device, or they might receive packets destined for other processes. e. Error detection. Error detection occurs at both the hardware and software levels. At the hardware level, all data transfers must be inspected to ensure that data have not been corrupted in transit. All data on media must be checked to be sure they have not changed since they were written to the media. At the software level, media must be checked for data consistency; for instance, whether the number of allocated and unallocated blocks of storage matches the total number on the device. There, errors are frequently process-independent (for instance, the corruption of data on a disk), so there must be a global program (the operating system) that handles all types of errors. Also, by having errors processed by the operating system, processes need not contain code to catch and correct all the errors possible on a system.