Tuesday, November 11, 2008

Client Server Communication with the help of Sockets

A socket is defined as an end point for communication between client and server.A socket is identified by a IP address concatenated with the port number.In general all sockets work on the client server architecture.In server client system, server waits for the incoming client request by listening to a specified port.Once the server received the request from the client it accepts the connection from the client socket to complete the connection.As there are some standards ports already defined for some specific services like a telnet server listens to port 23,a ftp server listen to port,a http server listens to port 80.All ports below 1024 are considered well known and we can use them to implement standard devices.Now when a client process requests to initiates a connection with the server,it is assigned a port by the host computer.This port is some arbitrary number greater that 1024.

Let us consider a example,there exists a client on host with IP address 185.145.23.87 wishes to establish a connection with the web server which is listening on the port 80 and having IP address 164.25.17.5,now let host X is assigned a port number 1547.Now this connection will contain a pair of sockets (185.145.23.87:1547) on host X and (164.25.17.5:80) on the web server.Now the packets traveled between the hosts are delivered to the appropriate process based on the destination port number.The main thing that kept in mind during connection that all connections must be unique,that means if another process on host X wants to establish a connection with web server then the port number that is assigned to this process must be greater that 1024 and different from 1547.

Hope you found this post useful.Waiting for your responses for further improvement.
Thanks for visiting.

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.

Tuesday, September 30, 2008

Operating System Services

Hello friends now its time to move forward with operating systems.In this post i am going to told you about the services that an operating system provides to a user.

Generally operating systems provide two types of services one that is provided to the programs and the other that is provided to the users of these programs.These operating system services are provided for the convenience of the programmer i.e to make the programming easier.Now lets begin with the first type of service that is provided to the user:

1.User Interface:As all we know almost all operating systems has user interface.Now this interface can be of any form either it may be command line interface,which uses text commands and a method for entering them or it may be graphical user interface(GUI) .In GUI the interface is a window system with a pointing device to direct I/O,choose from menus,and make selections and a keyboard to enter text.

2.I/O operations: Whenever a program is running it requires some I/O resources to complete its execution.For specific devices, special resources may be required such as a cd or dvd driver to for recording of a cd or dvd.For efficiency and protection,users cannot control I/O devices directly.Hence operating system provide some means to do I/O.

3.File system manipulation: The file system manipulation is a different area of interest.As all we know that some programs need to read and write of files and directories.They also need to create and delete them by name,search for a given file and list file information.So for doing all these instructions some program is required that include permissions management to allow or deny access to files or directories based on ownership.

[caption id="attachment_57" align="aligncenter" width="397" caption="Services that an operating system provides to its users".

4.Communications: Sometimes their exists a situation in which one process needs to exchange information with another process.Such communication may occur between the processes that executing on the same computer or between processes that are executing on different computer systems but exists in same computer network.Now this communication may be implemented by shared memory or through message passing,in which packets of information are moved between processes by the operating system.

5.Error Detection: One of the most important service that is provided by an operting system to its user is error detection.Error may occur in CPU,in memory,in I/O devices(such as parity error on tape,a connection failure on the network) and in the user program(such as arithmetic error,an attempt to access an illegal memory location).For each type of error,the operating system should take appropriate action to ensure correct and consistent computing.

All these are the services that are provided by an operating system to its user.
Hope you enjoy this post.Waiting for your comments for more improvement.

Caching in Operating Systems


Hello friends in the last post i told you about the memory management in operating systems,now in this post i am going to tell you about the caching i operating system.

Caching is an important principle of computer systems.As all we know all information is kept in some storage such as main memory,as it is used,it is copied into a faster storage system-the cache-on a temporary basis.When we need a particular piece of information,we first check whether it is in cache or not,if it is in the cache we use it directly from the cache,otherwise we use the information from the source from where it is present and made a copy of that information in the cache assuming that we will need it again soon.By doing so we decreases the searching time of that particular information.



As all we know that the purpose of cache is to speed up memory accesses by storing recently used chunks of memory.Now why the need of caching or cache memory is required because as all we know that access from main memory into a register may take 20-50 clock cycles,but in the case of cache memory it reduces to single clock cycle.That's why cache memory or caching is needed.But the cache memory that we used is very expensive in cost that's why we can't compose our main memory entirely of it.

For more details , please visit here and here.
Thats why we have only very limited amount of cache,and we can store only limited amount of data in it,now the main question that arises here is that to store which data from the great chunk of data.For this we only save that data that is most recently used.Sometimes this policy is also known as the spatial and temporal locality.When we want to access memory at a certain address, we look in the cache to see if it is there. If it is there, we get it from cache instead of going all the way to memory, that situation is called a "cache hit." If the data is not in cache, then we bring the data from memory to cache, which takes longer since the data must be brought in from the smaller memory, that situation is called a "cache miss," and that delay that we endure because that memory must be brought from main memory is called a "miss penalty".

For more details , please visit here and here.

Hope you enjoy it.Please give your comments for more improvement.

Sunday, September 28, 2008

Memory management in operating systems

Hello friends this is my first post and in this post i am going to told you about memory management in operating systems.

If we talk about the memory management then it simply means that we are going to manage only the main memory(RAM) not secondary memory(Hard disk).As all we know that main memory is central to the operation of a modern computer system.The main task of a memory manager is to made available the memory first to the primary process then to the other.If we talk about the main memory we know that it is a large array of words or bytes ranging from millions to billions.Each word or byte has its own address.The central processor reads instructions from the main memory during the instruction fetch cycle and both reads and writes data from the from the main memory during the fetch cycle.

The main memory is only the memory that a CPU can access directly otherwise for accessing any instruction from disk then it first transferred to the main memory then CPU executes it.For a program to be executed it must be mapped to the absolute address and loaded into memory.Now as the CPU executes this program the its accessing instructions and data by generating their absolute addresses.Eventually when this program terminates it releases its occupied main memory and this memory is allocated to the next program and loaded in it.Now to improve both CPU utilization's and its speed of computer response to its users,general purpose computers keep several programs in memory,creating a need for memory management.Today there exists a lot of memory management schemes but to select a particular management scheme is totally depends on the situation or sometimes it depends on the hardware design of the system.

Each algorithm requires its own hardware support.Now in addition to memory management CPU is also engaged in various activities of memory.


  • Keeping track of which part of memory are currently being used and by whom.

  • Deciding which process or data to move into and out of memory.

  • Allocating and Deallocating memory space as needed.

Introducing Blog

Hello friends this is my first blog and in this blog i am going to explore all the important concepts of operating system in which students find themselves in difficulty.Here you will find a complete description of all the topics that will really help you in understanding these concepts.In this blog I will also provide you a great comparison of different types of operating systems like Windows XP,UNIX,LINUX and Macontish according to their services.In this blog you will also found some latest hacking technologies in Windows XP,UNIX and Linux that will definitely a fun stuff for you.In addition to this i also give you latest news from the field of technology and also some reviews.

Hope you enjoy it.