Friday, 26 August 2016

os

OPERATING SYSTEM
Q1. What is operating system?
·        An operating system is software which is used to operate the computer. Operating system acts as a between the user and computer hardware.
·        An operating system (OS) is a collection of software that manages computer hardware resources and provides common services for computer programs.
·        The operating system is a vital component of the system software in a computer system.
An operating System (OS) is an inter mediator between users and computer hardware. It provides users an environment in which a user can execute programs conveniently and efficiently.
In technical terms, it is software which manages hardware.
·        An operating System controls the allocation of resources and services such as memory, processors, devices and information.
An operating system is a program that acts as an interface between the user and the computer hardware and controls the execution of all kinds of programs.
Q2. What are the important functions of operating system?
Following are some of important functions of an operating System.
·        Memory Management - It refers   to management of Primary Memory or Main Memory.
·        Processor Management - It refers   to management of processing. Which process gets the processor when and how.
·        Device Management - It refers  to management of Device .which connected to the computer Os creates an environment for user to understand the hardware devices and for devices to understand the user
·        File Management - It refers to management of File .os maintain the file as directories and subdirectories.

·        Security - It refers to management of Security .os maintain the security of files and your whole system.
·        Control over system performance - It refers to management of control of overall system performance.
·        Job accounting - Keeping track of time and resources used by various jobs and users
·        Error detecting aids - Production of dumps, traces, error messages and other debugging and error detecting aids.
·        Coordination between other software and users - Coordination and assignment of compilers, interpreters, assemblers and other software to the various users of the computer systems.
Q3. What operating system gives to user and hardware?
·        For user -> As we know that an operating system is one of the most important part of the computer. 
ü The operating system allows the user to work on the computer without having to know all the detail about how to hardware work.
ü It connect user to the hardware easily.
ü It makes an environment for user to interacting with computer.
·        For hardware -> The operating system allows the hardware workable as user requirement.
ü It connects the hardware to user.
ü It makes environment for hardware and user.
ü Operating system controls all hardware peripheral for processing and storing.
Q4.  Explain Memory Management?
·        Memory management refers to management of Primary Memory or Main Memory.
·        Main memory is a large array of words or bytes where each word or byte has its own address.
·        Main memory provides a fast storage that can be access directly by the CPU. So for a program to be executed, it must in the main memory. Operating System does the following activities for memory management.
·        Keeps tracks of primary memory i.e. what part of it are in use by whom, what part are not in use.
·        In multiprogramming, OS decides which process will get memory when and how much.
·        Allocates the memory when the process requests it to do so.
·        De-allocates the memory when the process no longer needs it or has been terminated.
·        Memory management is the functionality of an operating system which handles or manages primary memory.
·        Memory management keeps track of each and every memory location either it is allocated to some process or it is free.
It checks how much memory is to be allocated to processes.
·        It decides which process will get memory at what time.
·        It tracks whenever some memory gets freed or unallocated and correspondingly it updates the status.
·        Memory management provides protection by using two registers, a base register and a limit register. The base register holds the smallest legal physical memory address and the limit register specifies the size of the range.
·        For example, if the base register holds 300000 and the limit register is 1209000, then the program can legally access all addresses from 300000 through 411999.

·        Instructions and data to memory addresses can be done in following ways
Ø  Compile time -- When it is known at compile time where the process will reside, compile time binding is used to generate the absolute code.
Ø  Load time -- When it is not known at compile time where the process will reside in memory, then the compiler generates re-locatable code.
Ø Execution time -- If the process can be moved during its execution from one memory segment to another, then binding must be delayed to be done at run time.

Q5.  What is virtual memory explain with advantages?
·        Virtual memory is a memory management scheme that overcomes these limitations by allowing execution of a process with the need to load the process in main memory completely.
·        User written error handling routines are used only when an error occurred in the data or computation.
·        Certain options and features of a program may be used rarely.
·        Advantage of virtual memory.
Ø Provide a large virtual memory to programmer on a system having smaller physical memory.
Ø Makes programming easier as programmers no longer need to worry about the memory size limitation.
Ø Enables execution of a process on a system who see main memory size is less than the total memory required by the process. 
Ø Enable a process’s execution to be started even when sufficient free memory for loading to entire process is not available.  
·        Following are the situations, when entire program is not required to be loaded fully in main memory.
Ø  User written error handling routines are used only when an error occurred in the data or computation.
Ø Certain options and features of a program may be used rarely.
Ø  Many tables are assigned a fixed amount of address space even though only a small amount of the table is actually used.
Ø The ability to execute a program that is only partially in memory would counter many benefits.
Ø Less number of I/O would be needed to load or swap each user program into memory.
Ø A program would no longer be constrained by the amount of physical memory that is available.
 Each user program could take less physical memory; more programs could be run the same time, with a corresponding increase in CPU utilization and throughput.

Q6. Explain Paging with advantages ?
·        External fragmentation is avoided by using paging technique. Paging is a technique in which physical memory is broken into blocks of the same size called pages (size is power of 2, between 512 bytes and 8192 bytes). When a process is to be executed, it's corresponding pages are loaded into any available memory frames.
·        Logical address space of a process can be non-contiguous and a process is allocated physical memory whenever the free memory frame is available. Operating system keeps track of all free frames. Operating system needs n free frames to run a program of size n pages.
·        Address generated by CPU is divided into  Page number (p) -- page number is used as an index into a page table which contains base address of each page in physical memory.
·        Page offset (d) -- page offset is combined with base address to define the physical memory address

·        Advantages
Ø It is flexibly in sharing machine between processes, which address sizes exceed the physical memory size. It also supports a wide range of user level stuff.
Ø The advantages of paging are, in Address translation where each task has the same virtual address. Address translation will turn fragmented physical addresses into contiguous virtual addresses. It provides Memory protection (buggy or malicious tasks can’t harm each other or the kernel) and shared memory between tasks that a fast type of IPC, also conserves memory when used for DLLs).
Ø It helps in Demand loading which prevents big load on CPU when a task first starts running, conserves memory. Paging requires memory mapped files, Virtual memory swapping which let system degrade gracefully when memory required exceeds RAM size. The process can be run whose virtual address space is larger than physical memory.
·        Disadvantages of Paging
Ø The disadvantages of paging are extra resource consumption, memory overhead for storing page tables. The worst cases are when page table may take up a significant portion of virtual memory.  Solution is to page the page table or go to a more complicated data structure for translations. Other disadvantage is translation overhead.

Q7. What is shell and why it is called important part operating system?
·        A shell is software that provides an interface for an operating system and user to provide access to the kernel’s services.
·        In another words the shell Is just an environment where applications can run in protected menu space so that resources can be shared among multiple active shells, with the kernel managing the resource request for input/output CPU stack execution or memory access.
·        Shell is also called important part of operating system because shell is the only environment where user and operating system meets together first for user name and password accessing. Also shell is the only environment who protects the whole computer data while a application running. Shell is a protection section who protects computer for unwanted activates.
Q8. What is BIOS explain?
·        BIOS (Basic Input /Output System) is a ROM chip located on all motherboards that allows you to access and set up your computer system at the most basic level.
·        ROM is boot firmware program that a computer uses to successfully start operating.
·        The BIOS is located on a chip inside of the computer and is designed in a way that protects it from disk failure.
·        When you turn on a PC, the BIOS first conduct a basic hardware check, called a Power-On Self Test (POST), to determine whether all of the attachments are present and working. Then it loads the operating system into your computer's random access memory, or RAM. The BIOS also manages data flow between the computer's operating system and attached devices such as the hard disk, video card, keyboard, mouse, and printer. The BIOS stores the date, the time, and your system configuration information in a battery-powered, non-volatile memory chip, called a CMOS (Complementary Metal Oxide Semiconductor) after its manufacturing process.
·        The four main functions of BIOS are given below-:
Ø (i)   BIOS power on self Test (POST)
Ø (ii)  Bootstrap loader
Ø (iii) BIOS Setup utility program
Ø (iv) System service routines
ü POST -Test the computer hardware and make sure no errors exist before loading the operating system. Additional information on the POST given below.


ü (i) Test the CPU
ü (ii)Initialize support chips
ü (iii)Initialize the keyboard
ü (iv)ROM BIOS test
ü (v)CMOS RAM test
ü (vi)Memory test
ü (vii)Cache initialization
ü (viii)Initialize the vector table
ü (ix)CMOS RAM check sum
ü (x)Keyboard initialization
ü (xi)Video circuit test
ü (xii)Video memory test
ü (xiii) DMA Controller test
ü (xiv)PIC tests
ü (xv) EISA mode test
ü (xvi)Enable EISA slots
ü (xvii)Check memory size
ü (xviii)Memory test
ü (xix)Check EISA memory


ü (xx)Mouse initialization
ü (xxi)Cache initialization
ü (xxii)Shadow RAM setup
ü (xxiii)Floppy test
ü (xxiv)Hard drive test



ü Bootstrap Loader -Locate the operating system. If a capable operating system is located, the BIOS will pass control to it.
ü BIOS drivers -Low level drivers that give the computer basic operational control over your computer's hardware.
ü BIOS or CMOS Setup -Configuration program that allows you to configure hardware settings including system settings such as computer passwords, time, and date.
Q9. Explain Schedulers?
·         Schedulers are special system software which handles process scheduling in various ways. Their main task is to select the jobs to be submitted into the system and to decide which process to run.
·        Schedulers are of three types
ü Long Term Scheduler
ü Short Term Scheduler
ü Medium Term Scheduler

·        Long Term Scheduler
It is also called job scheduler. Long term scheduler determines which programs are admitted to the system for processing. Job scheduler selects processes from the queue and loads them into memory for execution. Process loads into the memory for CPU scheduling. The primary objective of the job scheduler is to provide a balanced mix of jobs, such as I/O bound and processor bound. It also controls the degree of multiprogramming. If the degree of multiprogramming is stable, then the average rate of process creation must be equal to the average departure rate of processes leaving the system.
On some systems, the long term scheduler may not be available or minimal. Time-sharing operating systems have no long term scheduler. When process changes the state from new to ready, then there is use of long term scheduler.
·        Short Term Scheduler
It is also called CPU scheduler. Main objective is increasing system performance in accordance with the chosen set of criteria. It is the change of ready state to running state of the process. CPU scheduler selects process among the processes that are ready to execute and allocates CPU to one of them.
Short term scheduler also known as dispatcher, execute most frequently and makes the fine grained decision of which process to execute next. Short term scheduler is faster than long term scheduler.
·        Medium Term Scheduler
Medium term scheduling is part of the swapping. It removes the processes from the memory. It reduces the degree of multiprogramming. The medium term scheduler is in-charge of handling the swapped out-processes.
Running process may become suspended if it makes an I/O request. Suspended processes cannot make any progress towards completion. In this condition, to remove the process from memory and make space for other process, the suspended process is moved to the secondary storage. This process is called swapping, and the process is said to be swapped out or rolled out. Swapping may be necessary to improve the process mix
·        Comparison between Scheduler

S.N.
Long Term Scheduler
Short Term Scheduler
Medium Term Scheduler
1
It is a job scheduler
It is a CPU scheduler
It is a process swapping scheduler.
2
Speed is lesser than short term scheduler
Speed is fastest among other two
Speed is in between both short and long term scheduler.
3
It controls the degree of multiprogramming
It provides lesser control over degree of multiprogramming
It reduces the degree of multiprogramming.
4
It is almost absent or minimal in time sharing system
It is also minimal in time sharing system
It is a part of Time sharing systems.
5
It selects processes from pool and loads them into memory for execution
It selects those processes which are ready to execute
It can re-introduce the process into memory and execution can be continued

Q10. What is file management?
·        A file is a collection of related information.
·        Every file has a name its date and attributes.
·        The name of a file is uniquely identifies in the system and it is used its user to access it.
·        There are two type of file access method.
Ø Sequential access file. Os use sequential access file for sequential method.
Ø Random access file. Os use Random access file for Random methods.
·        File operation example-:





Ø Create                                            
Ø Delete
Ø Open
Ø Close
Ø Read
Ø Write
Ø Seek
Ø Get attrib
Ø Set attrib
Ø Rename copy



·        File extension.


Ø .bas -> basic source page file.
Ø .c -> c source page file.
Ø .bin -> binary program file.
Ø .dat -> data file.
Ø .hlp -> text file for help command.
Ø .txt -> text file.
Ø .bak -> backup file.
Ø .doc -> document file.
Ø .jpg -> jpeg picture file.

File structure
·        File structure is a structure, which is according to a required format that operating system can understand.
·         A file has a certain defined structure according to its type.
·        A text file is a sequence of characters organized into lines.
·         A source file is a sequence of procedures and functions.
·         An object file is a sequence of bytes organized into blocks that are understandable by the machine.
·         When operating system defines different file structures, it also contains the code to support these file structure. UNIX, MS-DOS support minimum number of file structure.

Q11. Device Controllers
A computer system contains a many types of I/O devices and their respective controllers
·        graphics adapter
·        disk controller
·        DVD-ROM controller
·        serial port
·        USB
·        sound card
·        network card 

Q12. What is task loader?
·        Task loader is a program in operating system.
·        It is also the part of system software.
·        A loader is a component that locates a given program. This can be application or in some case other part of operating system itself.
·        It is responsible for loading program and library.
·        It is one of the essential stages in the process of starting a program, as it place programs into memory and prepares them for the execution.
·        Loading a program involves reading the content of executable file into memory.
·        Once task loading is complete then operating system starts the program by passing the control to the loaded program code.
·        All operating system that support program loading have loader, the loader is permanently resident in memory.

Q13. Explain Paging with advantages ?
·        External fragmentation is avoided by using paging technique. Paging is a technique in which physical memory is broken into blocks of the same size called pages (size is power of 2, between 512 bytes and 8192 bytes). When a process is to be executed, it's corresponding pages are loaded into any available memory frames.
·        Logical address space of a process can be non-contiguous and a process is allocated physical memory whenever the free memory frame is available. Operating system keeps track of all free frames. Operating system needs n free frames to run a program of size n pages.
·        Address generated by CPU is divided into  Page number (p) -- page number is used as an index into a page table which contains base address of each page in physical memory.
·        Page offset (d) -- page offset is combined with base address to define the physical memory address
·        Advantages
Ø It is flexibly in sharing machine between processes, which address sizes exceed the physical memory size. It also supports a wide range of user level stuff.
Ø The advantages of paging are, in Address translation where each task has the same virtual address. Address translation will turn fragmented physical addresses into contiguous virtual addresses. It provides Memory protection (buggy or malicious tasks can’t harm each other or the kernel) and shared memory between tasks that a fast type of IPC, also conserves memory when used for DLLs).
Ø It helps in Demand loading which prevents big load on CPU when a task first starts running, conserves memory. Paging requires memory mapped files, Virtual memory swapping which let system degrade gracefully when memory required exceeds RAM size. The process can be run whose virtual address space is larger than physical memory.
·        Disadvantages of Paging
Ø The disadvantages of paging are extra resource consumption, memory overhead for storing page tables. The worst cases are when page table may take up a significant portion of virtual memory.  Solution is to page the page table or go to a more complicated data structure for translations. Other disadvantage is translation overhead.

Q14. what is life cycle of process/ process state.
·        A process goes through a series of disrcete process state during its life time. Depending on the implementation, the operating system may differ in the number of states a process goes through .
·        There are various states models starting from two states to nine states .
See below.
·        Five state process model
ü New state -> The process being created.
ü Terminated -> The process has finished execution.
ü Blocked (waiting state) -> When a process blocks, it does so because logically in can’t continue, typically because it is waiting for input that is not yet available. A process is said to be blocked if it is waiting for some event to happen (such as an input /output completion) before it can processed. In this state a process is unable to run until some external events happens.
ü Running state ->  A process is said to be running if it currently has the cpu which is actually using the cpu at that particular instance.
ü Ready state -> A process is said to be ready if it is use a cpu if one were available if it is run-able but temporally stopped to let another process run.



 


                              5                                                                                                                           6
Oval: RUNNINGOval: READY                                                                   3
 

                               4                                  2                                  1



No comments:

Post a Comment