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.

Friday, August 12, 2011

Class Path Vs Build Path

This topic is liitle bit off to the operating system concepts but still I want to share it ;)

The classpath is the classic way to tell the Java compiler and the Java runtime where to find compiled classes. It is typically a sequence of JAR file names and directory names. The classpath used by the compiler and the runtime system don't have to be the same, but they typically "should be*, especially for a small project.

Buildpath is not classic Java terminology. It is the term for the richer way that a typical IDE specifies the relationship between the "modules" or "projects" that make up an application. The IDE uses this to figure out the classpath and sourcepath for compiling the Java code, and the classpath for running it. The IDE also uses the build path to figure out how to package up your code and its dependencies as (for example) a WAR file.

For example, an Eclipse build path for a project includes the other projects that it depends on, and lists any additional library JARs that the project contains / relies on. It also lists the packages in the current project that downstream projects can depend on.

(If you are using Maven for your project, the IDE buildpath mechanism is secondary to the dependencies declared in the POM files. For example, using Eclipse with the m2eclipse, the buildpath is synthesized from the POM files.)

Wednesday, August 3, 2011

Virtual Machines

The fundamental idea behind a virtual machine is to abstract the hardware of a single computer (the CPU, memory,disk drives, network interface cards, and so forth) into several different execution environments, thereby creating the illusion that each separate execution environment is running its own private computer.By using CPU scheduling and virtual-memory techniques
), an operating system can create the illusion that a process has its own processor with its own (virtual) memory.

Normally, a process has additional features, such as system calls and a file system, that are not provided by the bare hardware. The virtual-machine approach does not provide any such additional functionality but rather provides an interface that is identical to the underlying bare hardware. Each process is provided with a (virtual) copy of the underlying computer. There are several reasons for creating a virtual machine, all of which are fundamentally related to being able to share the same hardware yet run several different execution environments (that is, different operating systems) concurrently.

Friday, July 29, 2011

Paging

Hello friends in this post we are going to discuss on paging and how an operating system used it for memory management.

Paging is another memory management technique which widely uses virtual memory concept. When paging is used, the processor divides the linear address space into fixed-size pages (of 4KBytes, 2 MBytes, or 4 MBytes in length) that can be mapped into physical memory and/or disk storage. When a program (or task) references a logical address in memory, the processor translates the address into a linear address and then uses its paging mechanism to translate the linear address into a corresponding physical address.

Some physical memory is reserved for the operating system itself, and for its data structures. This is called wired memory, because it is not subject to paging. The rest of physical memory is managed via the paging mechanism, and is called the page pool. Whenever a virtual memory page that is not in physical memory is referenced, a page is allocated from the page pool’s free list and mapped to the required virtual memory address. Pages are returned to the free list when the memory has been unmapped or freed. Pages can be reclaimed from the free list if they are referenced again before the physical memory page has been reused.
OS performs an operation for storing and retrieving data from secondary storage devices for use in main memory. Paging is one of such memory management scheme. Data is retrieved from storage media by OS, in the same sized blocks called as pages. Paging allows the physical address space of the process to be non contiguous. The whole program had to fit into storage contiguously.

Paging is also used to deal with external fragmentation problem. This is to allow the logical address space of a process to be noncontiguous, which makes the process to be allocated physical memory.

You can also visit my other blogs:
Networking Concepts
Technomedia
Enter into world of Technology
Hina Rabbani Khar




Tuesday, July 26, 2011

Round Robin Scheduling

Round robin is the scheduling term which is being used for the purpose of algorithms which is mainly used for the purpose of operating systems. This system had mainly been used in order to handle out the processes which are incurred in the operating system which means that the time that is being taken for the opening of the program and then as a result the user is being shown with the process chart which is being drawn. The entire process is being done in equal portions where each and every item is being taken into account.


On the other hand a process schedule had been defined for the round robin scheduling system. This form is adopted in that case when the jobs or certain other tasks are to be performed. The round robin schedule is one of the easiest and simplest forms of doing the work and hence it can be carried out and implemented easily. The data is also being used in the round robin scheduling which means that in such a situation the user have to bear the data packet scheduling process. It had been found out that first come first serve basis is one of the alternative which can be used in the form of the round robin scheduling. This is one of that forms of scheduling which can be applied to other forms of scheduling as well and at time it is also used for the purpose of handling the problems too.

It is also used in the computation of the computer networks which is found to be quite helpful in the data packet scheduling process. The entire process of round robin scheduling generates about minimum and maximum of the results and it is referred to as the min-max fairness which means that each and everything is to be carried out on equal basis

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.