1. The major difference between deadlock, starvation and race is that in deadlock, the problem occurs when the jobs are processed.
Race conditions:
Threads can try to update the same data structure at the same time.The result can be partly what one thread wrote and partly what the other thread wrote.
Deadlock:
To avoid updating the same data structure at the same time, threads lock adata structure until they have finished making their modifications to it.
Starvation:
In its effects, starvation is similar to deadlock in that some threads do notmake progress. But the causes of starvation are different from those of deadlock: Thethreads could, in theory, execute, but they just don’t get time on a processor, perhapsbecause they don’t have a high enough priority.
2. Example of Deadlock:
When two trains approach each other at a crossing, both shall come to a full stop and neither shall start up again until the other has gone.Example of Starvation: When one person borrowed a pen from his classmate and hisclassmate get his pen back.Example of Race:When two guys have the same girlfriend.
3. Four necessary condition needed for the deadlock from exercise #2:
if the product is only one.if the two person needed that one product urgently.if there's other alternative products available.if the two person are brand concious and the product happen to be what they like.
4.
5.a. Deadlock will not happen because there are two traffic lights that control the traffic. But when some motorist don't follow the traffic lights, deadlock can occur because there's only one bridge to drive through.
b. Deadlock can be detected when there will be a huge bumper to bumper to the traffic and there will be accident that will happen.
c. The solution to prevent deadlock is that, the traffic lights should be accurate and motorist should follow it. In order to have a nice driving through the bridge.
6. Based on figure 5.17 answer the following question.a. is this system deadlock?-this is an deadlock because P2 still requesting or waitng for R1 that has already been allocated.
Tuesday, January 15, 2008
Sunday, December 2, 2007
*Virtual Memory*
The program thinks it has a large range of contiguous addresses; but in reality the parts it is currently using are scattered around RAM, and the inactive parts are saved in a disk file.
Virtual memory is a computer system technique which gives an application program the impression that it has contiguous working memory, while in fact it is physically fragmented and may even overflow on to disk storage. Systems which use this technique make programming of large applications easier and use real physical memory (e.g. RAM) more efficiently than those without virtual memory.
Note that "virtual memory" is not just "using disk space to extend physical memory size". Extending memory is a normal consequence of using virtual memory techniques, but can be done by other means such as overlays or swapping programs and their data completely out to disk while they are inactive. The definition of "virtual memory" is based on tricking programs into thinking they are using large blocks of contiguous addresses.
All modern general purpose computer operating systems use virtual memory techniques for ordinary applications, such as word processors, spreadsheets, and multimedia players. Older operating systems, such as DOS of the 1980s, or many mainframe operating systems of the 1960s, had no virtual memory functionality.
Embedded systems and others in which very fast, very consistent response time is essential do not generally use virtual memory.Paged virtual memory
Almost all implementations of virtual memory divide the virtual address space of an application program into pages; a page is a block of contiguous virtual memory addresses. Pages are usually at least 2K bytes in size, and systems with large virtual address ranges or large amounts of real memory generally use larger page sizes.
Paging - is the process of saving inactive virtual memory pages to disk and restoring them to real memory when required.
Most virtual memory systems enable programs to use virtual address ranges which in total exceed the amount of real memory (e.g. RAM). To do this they use disk files to save virtual memory pages which are not currently active, and restore them to real memory when they are needed. Pages are not necessarily restored to the same real addresses from which they were saved - applications are aware only of virtual addresses. Usually the real memory to which a page is restored contains another virtual memory page which has been used recently, and which must therefore be saved to disk.Paging supervisor
This part of the operating system creates and manages the page tables. If the dynamic address translation hardware raises a page fault interrupt, the paging supervisor searches the page file(s) (on disk) for the page containing the required virtual address, reads it into real physical memory, updates the page tables to reflect the new location of the virtual address and finally tells the dynamic address translation mechanism to start the search again. Usually all of the real physical memory is already in use and the paging supervisor must first save an area of real physical memory to disk and update the page table to say that the associated virtual addresses are no longer in real physical memory but saved on disk. Paging supervisors generally save and overwrite areas of real physical memory which have been , because these are probably the areas which are used least often. So every time the dynamic address translation hardware matches a virtual address with a real physical memory address, it must put a time-stamp in the page table entry for that virtual address.
Wednesday, November 21, 2007
operating System
operating System(summary)
An operating system (OS) is the software that manages the sharing of the resources of a computer and provides programmers with an interface used to access those resources. An operating system processes system data and user input, and responds by allocating and managing tasks and internal system resources as a service to users and programs of the system. At the foundation of all system software, an operating system performs basic tasks such as controlling and allocating memory, prioritizing system requests, controlling input and output devices, facilitating networking and managing file systems. Most operating systems come with an application that provides a user interface for managing the operating system, such as a command line interpreter or graphical user interface. The operating system forms a platform for other system software and for application software.
Personal evaluation
computer systems usually share common functions with real operating systems, but tend to be able to perform these functions at faster speeds with a more aesthetic graphical user interface (GUI), and are exceptionally more functional than today's software.
Subscribe to:
Posts (Atom)