Showing posts with label Operating Systems. Show all posts
Showing posts with label Operating Systems. Show all posts

Saturday, August 27, 2011

Deadlock in Operating Systems

A system consists of a finite number of resources to be distributed among a number of competing processes. The resources are partitioned into several types, each consisting of some number of identical instances. Memory space, CPU cycles, files, and I/O devices (such as printers and DVD drives) are examples of resource types. If a system has two CPUs, then the resource type CPU has two instances. Similarly, the resource type printer may have five instances.If a process requests an instance of a resource type, the allocation of any instance of the type will satisfy the request. If it will not, then the instances are not identical, and the resource type classes have not been defined properly.

For example, a system may have two printers. These two printers may be defined to be in the same resource class if no one cares which printer prints which output.
However, if one printer is on the ninth floor and the other is in the basement, then people on the ninth floor may not see both printers as equivalent, and separate resource classes may need to be defined for each printer.A process must request a resource before using it and must release the resource after using it. A process may request as many resources as it requires to carry out its designated task. Obviously, the number of resources requested may not exceed the total number of resources available in the system. In other words, a process cannot request three printers if the system has only two.

Saturday, July 23, 2011

All about Semaphores

A semaphore is a synchronization mechanism that can be used to manage synchronization relationships and implement the access policies. A semaphore is a special kind of variable that can only be accessed by very specific operations. The semaphore is used to help threads and processes synchronize access to shared modifiable memory or manage access to a device or other resource. The semaphore is used as a key to access the resource. This key can only be owned by one process or thread at a time. Whichever task owns the key or semaphore locks the resource for its exclusive use.

Types:
Counting semaphores are used when you might have multiple devices (like 3 printers or multiple memory buffers).

Binary semaphores are used to gain exclusive access to a single resource (like the serial port, a non-reentrant library routine, or a hard disk drive). A counting semaphore that has a maximum value of 1 is equivalent to a binary semaphore (because the semaphore's value can only be 0 or 1.

Mutex semaphores are optimized for use in controlling mutually exclusive access to a resource. There are several implementations of this type of semaphore.

Implementation:
Semaphores can be implemented with a queue and an integer counter. You maintain the set of consumers in the queue, and when a consumer releases the semaphore, you retrieve the next entry in the queue and "wake" them to allow them to enter the critical section. When a consumer requests the semaphore, you simply push them onto the queue. If no one is in the critical section, you go ahead and grant the requester the right to enter the critical section.

Thursday, July 21, 2011

Real Time Operating System

A real time operating system is based on the OS which has the capability to perform a number of functions at a time. This RTOS only serves real-time applications. These real-time applications include robots, spaceships; research tools used by scientists and embedded systems like home appliances, cell phones and thermostat.

RTOS system captures the real time events and brings out the results which may slightly differ from the reality. It’s processing and computation totally depends on the way it is programmed. RTOS can be judged as how quickly it performs the operation and how accurate the results are. Most important factors which increase the working of this system are low interrupt latency and a low thread switching latency.

The real time operating system is designed keeping in mind every aspect in mind of real life. This operating system is designed on two basic principles. First design pattern is that it should focus on event-driven programming so that tasks can process depending upon their scheduling priorities. Second design refers to time sharing feature so to process tasks on the basis of clock interrupts.

In RTOS allocation of memory is the most critical task. Two elements are of significant importance in case of memory allocation. First one is speed and second is the fragmentation of free region during the memory allocation process.

Tuesday, July 12, 2011

OS-9

I was trying to write this post from last 2 years, but always i postponed it.Now I have decided to done it.This post is about an operating system OS-9 from legacy systems developed by Microware.OS-9 is a real-time, multiuser, multitasking operating system developed by Microware Systems Corporation. It provides synchronization and mutual exclusion primitives in the form of signals, events, and semaphores. It also allows communication between processes in the form of named and unnamed pipes, as well as shared memory in the form of data modules.

OS-9 is modular, allowing new devices to be added to the system simply by writing new device drivers, or if a similar device already exists, by simply creating a new device descriptor. All I/O devices can be treated as files, which unifies the I/O system. In addition, the kernel and all user programs are ROMable. Thus, OS-9 can run on any supported hardware platform from simple diskless embedded control systems to large multiuser minicomputers.

Originally developed for the 6809 microprocessor, OS-9 was a joint effort between Microware and Motorola. The original version of OS-9 (OS-9 Level I) was capable of addressing 64 kilobytes of memory. OS-9 Level II took advantage of dynamic address translation hardware, and allowed a mapped address space of one megabyte on most systems, and up to two megabytes on others, most notably the Tandy Color Computer 3.

In the 1980's, Microware ported OS-9 to the 68000 family of microprocessors, creating OS-9/68000, which is used in a variety of industrial and commercial arenas, including Philips' CD-i and most recently, set-top boxes for interactive television.

Monday, July 11, 2011

Error in Loading Operating System

The Error Loading Operating System error appears when your operating system fails to load properly. This error is localized to the Microsoft Windows XP operating system, so users of other operating systems should not face this problem. Essentially, the Error Loading Operating System occurs at a point between the computer’s BIOS running checks on the system’s hardware and the actual launching of the operating system. This error is usually accompanied by a black screen and occurs directly after the installation of Windows XP.

What causes this error?
You can expect to see the Error Loading Operating System error when there is an issue with the way the BIOS and the Windows XP operating system are communicating with each other. Most commonly, the BIOS has an issue where it does not support or has no way to correctly manage the capacity of the hard drive that Windows XP was installed to.

How can I resolve this error?
The Error Loading Operating System problem can be solved in a variety of different ways. However, it is important that you have some knowledge of computers before you proceed with any of the suggested solutions to this error message. Not knowing exactly what you are doing, or failing to follow the directions you see on your screen could result in the corruption or destruction of your computer. Changing or flashing your BIOS can have detrimental effects on your computer and should only be performed if you are completely sure you know what you are getting into.

Your first step to resolve the Error Loading Operating System issue should be to update your computer’s BIOS. Check your computer’s manual for information on how to do this or call the company which constructed your computer. Alternatively, if you built your computer yourself, consult the manual which came with your motherboard.

Once you are sure that your BIOS has been upgraded to its most recent version, determine which type of BIOS you are using. Each BIOS is somewhat different, and newer versions of popular BIOSes tend to change the locations of different functions and features, so consult your computer vendor, your motherboard manual, or a tech support forum for the most up to date information on how to make sure that your hard drives are interfacing properly with your BIOS.

Tuesday, April 27, 2010

Cluster Computing

In computers, clustering is the use of multiple computers, typically PCs or UNIX workstations, multiple storage devices, and redundant interconnections, to form what appears to users as a single highly available system. Cluster computing can be used for load balancing as well as for high availability. Advocates of clustering suggest that the approach can help an enterprise achieve 99.999 availability in some cases. One of the main ideas of cluster computing is that, to the outside world, the cluster appears to be a single system.

A common use of cluster computing is to load balance traffic on high-traffic Web sites. A Web page request is sent to a "manager" server, which then determines which of several identical or very similar Web servers to forward the request to for handling. Having a Web farm (as such a configuration is sometimes called) allows traffic to be handled more quickly.Clustering has been available since the 1980s when it was used in DEC's VMS systems. IBM's sysplex is a cluster approach for a mainframe system. Microsoft, Sun Microsystems, and other leading hardware and software companies offer clustering packages that are said to offer scalability as well as availability. As traffic or availability assurance increases, all or some parts of the cluster can be increased in size or number.

Sunday, February 22, 2009

Operating System Structure Part-2

In the last post we had seen the first method in which an operating system can be structured i.e Simple Structure.From the last post about simple structure it is very much clear that this method is not very much efficient and there may be other structuring techniques that are much more efficient than simple structure technique.The most important thing for the success of any operating system structure is its hardware support,if an operating system got the proper hardware support then it can be broken into pieces that are more smaller and more effective then that of simple structure.If this is done successfully then an operating system can have much more control over the computer and the applications that are used by computers.In this post we take a look at the other method of making an operating system more modular i.e Layered Approach.

Layered Approach:-In this method of structuring the whole operating system is divided into a number of layers,in which the lowest layer represents the hardware part and the highest layer represents its user interface part.Each layer in this model is an implementation of abstract object model that contains objects and the routines that are required to access these objects.In layered approach a layer can only invoked the operations of its lower level layers.This approach helps very much in simplifying debugging and system verification.The first layer can be debugged without any concern for the rest of the system because their is no layer below the first layer and underlying hardware are assumed to be functioned correctly.Once the first layer is debugged,we can assume its correct functioning and we can debugged the second layer and so on.If an error is found during debugging of that layer then that error belongs to that particular layer because all the underlying layer are already debugged.Thus, the design and implementation of the system is simplified.
The main problem that exists with the layered approach is in defining the functions of every layer because a layer can only use its lower level layers for its functioning.One more problem that exists with this layered approach is that they tend to be less efficient than other types.For instance consider an example,when an user program executes an I/O operation,it executes a system call that is trapped to the I/O layer,which then call the memory management layer,which in turn call the CPU scheduling layer and then passes to the hardware.In this whole process,the each layer add its corresponding overhead result in that system call takes more time in comparison to the non-layered approach.

Saturday, February 21, 2009

Operating System Structure Part-1

If a system is large as well as complex then it is required that it must be designed carefully so that it can function properly and can be modified easily.The most common approach to achieve this is to partition the whole system into small components rather than having a single big structure.Now there are four approaches for achieving this.In this post we take a look at the first approach for structuring the system i.e Simple Structure.

Simple Structure:As all we know that every commercial system do not have well defined structure,the main reason behind this is,initially when these system are developed they developed as a simple,small,having limited functionality and then with time they started to grew up beyond their scope.The most common example of such type of a commercial system is MS-DOS.Initially when it was written the designers of DOS have no idea that this operating system became so popular in future.The main aim of designing this MS-DOS is to provide each and every functionality in a very limited space.So,in achieving this it was not divided into modules carefully.

In MS-DOS,the interfaces and level of functionality are not well separated.The major drawback of this thing is that application programs are able to access the basic I/O routines that means they can directly read or write to the basic display and disk drives.Due to this problem,the MS-DOS is very much vulnerable to the malicious programs,causing entire system crashes on the failing of user program.The other major problem with MS-DOS is that it is limited to hardware of its era because at that time the Intel 8088 for which it was written provides no dual mode and no hardware protection.Hence,in short we can say that their exists a lot of problem with this simple structure.

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.

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

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.