Friday, October 24, 2008

Understanding System Booting

The procedure of starting a computer by loading the kernel is known as booting the system.In general every computer system has a small piece of code known as bootstrap program or bootstrap loader whose main task is to locate the kernel then load it into main memory and starts its execution.In some computers this process takes place in two steps in which in the first step a simple bootstrap loader fetches the more complex program boot program from the disk, which in turn loads the kernel(2nd step).Whenever any computer is powered or rebooted,the instruction register is loaded with a predefined location(at which bootstrap program is present),and execution starts their.This bootstrap program is in the form of Read Only Memory because RAM is in an unknown state at start up and in addition to this ROM is virus free because it is read only.In addition to this a bootstrap program perform a variety of task like to run diagnostics to check the state of machine.If the diagnostics is successful then the program is continued with booting steps.

All small application devices like cellular phones,PDA's and game consoles store their operating system in ROM.It is always recommended to store small operating system in ROM.But in the case of large operating system like Windows,Linux and Mac OS X or for the systems that change frequently,the bootstrap loader program is stored in firmware(ROM) and operating system is on disk. In this case the bootstrap runs diagnostics and has a bit of code that can read a single block at the fixed location from disk into memory and execute the code from that boot block.The program stored in the boot block may be sophisticated enough to load the entire the operating system into memory and begin its execution.Now after that full bootstrap program is loaded and it can traverse the file system to find the operating system kernel load it into memory and start its execution and at this point we can say that system is running.

Sunday, October 19, 2008

Role of Timer in Operating System

Timer in Operating System:As all we know that it is only the operating system that has full control over the CPU,and it is the primary duty of operating system to prevent user programs from getting stuck into an infinite loop or not calling to system services and never returning control back to the operating system.To accomplish all those services an operating system uses a device known as Timer.The main task of a timer is to interrupt the CPU after a specific period of time.This specific period of time is set by operating system and its value may very from 1 ms to 1 second.If the operating system is interested in using variable timer then it is implemented with the help of fixed rate clock or counter and in this case operating system sets the counter.

Working of Timer:Whenever the clock ticks,the counter is decremented.When the value of this counter reaches zero an interrupt occurs and control is transferred back to the operating system.Let's understand this with the help of example,A 10 bit counter with a 1 Millisecond clock allows interrupts at interval from 1 millisecond to 1024 milliseconds,in steps of 1 millisecond.Before turning control over to the user process an operating system ensures that timer is set to interrupt.Hence a timer can be used to prevent a user program from running too long.We can also initialize the value of counter with the amount of time that a process requires to complete its execution.For example,a program with 7 minutes time limit has its counter initialized to 420,and for every clock tick the counter is decremented by 1.Hence after 420 ticks the control is automatically transferred back to the operating system.

Monday, October 13, 2008

Dynamic Loading

As all we know the an entire program and the data of all the process is always kept in physical memory for the process to execute this data.Here,in this situation the size of process is limited to the size of the physical memory.Here to obtain better space utilization we use dynamic loading.In dynamic loading a routine is never loaded into memory until it is called.All routines are kept on the disk in a relocatable load format.

First of all main program is loaded into memory and executed,now after this when a routine needs to call another routine,the calling routine first checks whether the other routine has been loaded.If the other routine is not loaded,then the relocatable linking loader is called to load the desired routine into memory and to update the program's address table to reflect this change. Then after this control is transferred to the newly loaded routine.The advantage of dynamic loading is that an unused routine is never loaded.This method is particularly useful when large amount of codes are needed to handle infrequently occurring cases such as error routines.

In all these cases the total program size may be large and the portion that is used may be much smaller.Dynamic Loading does not require any special support from the hardware or from the operating system.It is the responsibility of programmers to design their programs to take advantage of such a method.Sometimes operating system also helps the programmer by providing library routines to implement dynamic loading.

Thursday, October 9, 2008

Logical Vs Physical Address space



An address generated by the CPU is commonly refereed as Logical Address,whereas the address seen by the memory unit,that is one loaded into the memory address register of the memory is commonly refereed as the Physical Address.The compile time and load time address binding generates the identical logical and physical addresses.However, the execution time address binding scheme results in differing logical and physical addresses.

For more details , please visit here and here.

The set of all logical addresses generated by a program is known as Logical Address Space,whereas the set of all physical addresses corresponding to these logical addresses is Physical Address Space.Now, the run time mapping from virtual address to physical address is done by a hardware device known as Memory Management Unit.Here in the case of mapping the base register is known as relocation register.The value in the relocation register is added to the address generated by a user process at the time it is sent to memory.Let's understand this situation with the help of example:If the base register contains the value 1000,then an attempt by the user to address location 0 is dynamically relocated to location 1000,an access to location 346 is mapped to location 1346.

For more details , please visit here and here.

The user program never sees the real physical address space,it always deals with the Logical addresses.As we have two different type of addresses Logical address in the range (0 to max) and Physical addresses in the range(R to R+max) where R is the value of relocation register.The user generates only logical addresses and thinks that the process runs in location to 0 to max.As it is clear from the above text that user program supplies only logical addresses,these logical addresses must be mapped to physical address before they are used.

For more details , please visit here and here.

Tuesday, October 7, 2008

User Operating System Interface Part-2

Hello friends in the last post i told you about the one way command line interface through which an user can interact with the operating system.Now in this post i am going to told you about the second way through which an user can interact with the operating system.

The second approach through which an user can interface with the operating system is through Graphical User Interface(GUI).This interface provides a mouse based window and menu system as an interface to the user,rather than entering commands through command line interface.A GUI provides a desktop metaphor where the mouse is moved to position its pointer on images,or icons,on the screen(desktop) that represent programs,files,directories and system functions.Depending on the mouse pointer location,clicking a button can invoke a program,select file or directory which is known as folder.Microsoft's first version of Windows version 1.0 was based upon a GUI interface to the MS-DOS operating system.Then after this various versions of windows systems proceeding its initial version had been developed Windows 98,Windows 2000,Windows XP and Windows Vista.

The choice of whether to use a command line or GUI interface is mostly depend on individual to individual.As a very general rule,many UNIX users prefer a command line interface because they provide powerful shell interfaces.Alternatively, most Windows users are pleased to use the Windows GUI environment and almost never use the MS-DOS shell interfaces.

Sunday, October 5, 2008

User Operating System Interface

Hello friends in this post i am going to told you about the ways through which an user can interact with the operating system.

There exists two fundamental approaches through which an user can interact with the operating system.First technique is command line interface or command interpreter with the help of which an user can directly enter commands and further these commands are executed by operating system.The second approach is GUI(Graphical User Interface) in which user gets graphical interface to interact with the operating system.Now first begins with command line interface.

Command Line Interface: The main function of the command interpreter is to get and execute the next user-specified command.Many of the commands given at this level manipulate files:create,delete,list,print,copy and so on.The MS_DOS and UNIX shell operate in this way.Now here also exists two ways in which these commands can be implemented.

The first approach implies that, the command interpreter itself contains the code to execute command.For ex: suppose we entered the command 'delete' to delete a file,then in this case the command interpreter jump to a section of code that sets up the appropriate parameter and sets the appropriate system call.The summary of this method is that command interpreter has itself its code for executing the command.

In the second approach whenever users enter any command the command interpreter did not understand the command in any way,what it does, it merely used the command to identify a file to be loaded into memory and executed.This approach is used in UNIX operating system.Thus the UNIX command to create a file is create file.txt. Now the UNIX operating system search for the file create,load the file into memory,and execute it with the parameter file.txt.The function that is associated with the create command would be defined completely by the code in the file create.With the help of this approach an user can add new commands to the system by creating new files with the proper names.

Friday, October 3, 2008

Operating System Services Part-2

Hello friends in the last post i told you about the services that an operating system provides to its user.Now in this post i am going to told you about the services that an operating system provides to itself for the efficient working of it.

1.Resource Allocation:Suppose when there are multiple users or multiple jobs exists at the same time,resources must be allocated to each of them.The main task of operating system is to manage all these resources.Some resources such as CPU cycles,main memory and file storage may have special allocation code,whereas others such as I/O devices may have much more general request and release code.To use all these resources in the best efficient way operating system have CPU scheduling routines that take into account the speed of the CPU for the CPU resources.There may also be routines to allocate printers,modems,USB storage drives,and other peripheral devices.

2.Accounting:If we desire to keep track of which users use how much and what computer resources then operating system also provides this facility in the form of accounting.This record keeping may be used for for billing purpose of the users or simply for accumulating usage statistics.Usage statistics may be a valuable tool for researchers who wish to reconfigure the system to improve computing services.


3.Protection and Security:
When several separate processes execute concurrently,it should not be possible for one process to interfere with the others or with the operating system itself.Protection involves ensuring that all access to system resources are controlled.Security of the system from the outsiders is also an important issue.Such security starts with requiring each user to authenticate himself or herself to the system,usually by means of a password,to gain access to system resources.This security is also applicable to the external I/O devices,including modems and network adapters from invalid access attempts .If a system is to be protected and secure,precautions must be instituted throughout it.

Hope you enjoy this post.Waiting for your response for more improvement.

Thursday, October 2, 2008

Process management in operating system

Hello friends from now onwards i am going to discuss various concepts of operating systems that are very necessary to grasp the fundamentals of operating systems.In the post i am going to discuss the process management in operating system.

Before i begin with process management first of all we have to understand what is a process.In simple words we can say that a process is a program that is running on our computer.Now this process may be running either in frontend or in backend of the computer.Each and every process is composed of one or more than one thread.It is possible that an operating system may contain more processes running than actual programs because some processes are running in the backend of the operating systems.Now we came to our main issue of process management.As all we know a process needs some resources like cpu time,memory files and I/O devices for the execution of its instructions.Sometimes these resources are allocated to the processes when they are created or sometime when they are in running state.Sometimes in addition to these resources we have also pass some initialization data that is known as input for the process.

To understand the concept of process management we have to very much clear about the terms process and program.The main difference between these two terms is that process is an active entity while program is a passive entity.Generally the management of each process is done with the help of program counter,in case of a single threaded process it has one program counter that specifies the execution of the next instruction.The execution of these process are sequential in nature.The CPU executes next instruction only when it successfully executed the previous instruction.In case of multi threaded process they have multiple program counters each pointing to the next instruction to execute a given thread.

A process is a unit of work in the system.These types of systems are collection of the process some of which are them operating system process that execute system code and some of them are user system process that executes the user code.In addition to process management, operating system is also engaged in various activities like:
-->Creating and deleting both user and system process.
-->Suspending and resuming process.
-->Providing mechanism for process synchronization.
-->Providing mechanism for deadlock handling.