Tuesday, January 15, 2008

Assignment 4

1. What are the major difference between deadlock, starvation and race?
-The major difference between deadlock, starvation and race is that in deadlock, the problem occurs when the jobs are processed. Starvation, however is the allocation of resource that prevents one job to be executed. Race occurs before the process has been started.

2. Give some "real life" examples (not related to a computer system environment) deadlock, starvation and race.

-Example of Deadlock: When the two person are both to buy a one product at the same time.
-Example of Starvation: When you borrowed a money and the owner want to get back her/his money.
-Example of Race: When the two mobile phone race for a price.

3. Select one example of deadlock from exercise 2 and list the four necessary conditions needed for the deadlock.

- if the product is only one,
- if the two person needed that one product urgently,
- if there's other alternative products available, and
- if the two person are brand concious and the product happen to be what they like.

4. Suppose the narrow staircase (used as an example in the beggining of this chapter) has become a major source of aggravation. Design an algorithm for using it so that both deadlock and starvation are not possible.
-

5.Figure 5.16 shows a tunnel going through a mountain and two streets parallel to each other-one at each entrance/exit of the tunnel. Traffic lights are located at each end of the tunnel to control the crossflow of traffic through each intersection. Based on the figure, answer the following question.

A. Can deadlock occur? How can it happen and under what circumtances?
- 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. How can deslock be detected?
- 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. Give a solution to prevent deadlock but watch out for starvation.
- 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.

Thursday, December 13, 2007

Assingment 3

Answer the Question:
1. What is the cause of thrashing?
Why does paging work?
*Locality model
-process migrates from one locality to another
-localities may overlap
Why does thrashing occur?
-locality > number of frames
-sum of localities > total memory size
How do we fix thrashing?
-Working Set Model
-Page Fault Frequency
2. How does the operating system detect thrashing?
-It doesn't. An operating system would have no idea that thrashing is happening. The OS would be responsible for making use of virtual memory to make up for the lack of physical RAM during a particular computing session, but would have no concept that this is causing issues with hardware.
3. Once thrashing is detected, what can the operating systems do to eliminate it?
-Thrashing is usually a symptom of low memory in your system. To minimize it, try adding more memory to your computer or try to cut down on use interface elements that use extra memory like complicated background images and detailed icons.
Explain the Following:
A.Multiprogrammng. Why is it to use?
-Multiprogramming is the technique of running several programs at a time using timesharing. It allows a computer to do several things at the same time. Multiprogramming creates logical parallelism.
B. Internal Fragmentation.How does it occur?
-Internal fragmentation is the space wasted inside of allocated memory blocks because of restriction on the allowed sizes of allocated blocks. Allocated memory may be slightly larger than requested memory; this size difference is memory internal to a partition, but not being used.
C. External Fragmentation. How does it occur?
-External Fragmentation happens when a dynamic memory allocation algorithm allocates some memory and a small piece is left over that cannot be effectively used. If too much external fragmentation occurs, the amount of usable memory is drastically reduced. Total memory space exists to satisfy a request, but it is not contiguous.
D. Compaction. Why is needed?
- In a data center, compaction is the reduction or consolidation of hardware to make better use of physical floor space. Although the goal of compaction is to be cost-effective and maximize real estate, increased hardware compaction puts more demands on power consumption and cooling requirements, two major cost elements in maintaining a large data center.-In storage area management (SAM), compaction is the automatic removal of expired data from a storage area network (SAN) to condense the existing archive and make room for new data.
E. Rellocation. How often should it be performed?
- Relocation is the process of replacing symbolic references or names of libraries with actual usable addresses in memory before running a program. It is typically done by the linker during compilation, although it can be done at run-time by a loader. Compilers or assemblers typically generate the executable with zero as the lower-most, starting address. Before the execution of object code, these addresses should be adjusted so that they denote the correct runtime addresses.
2. Describe the major disadvantages for each of the four memory allocation schemes presented in the chapter.
-The major disadvantage only 1 job per partition and waste of main storage.
3. Describe the major advantages for each of the memory allocation schemes presented in the chapter.
-The major advantage of this is operating system is easy to implement.
Virtual Memory:


A program instruction on an Intel 386 or later CPU can address up to 4GB of memory, using its full 32 bits. This is normally far more than the RAM of the machine. (The 32nd exponent of 2 is exactly 4,294,967,296, or 4 GB. 32 binary digits allow the representation of 4,294,967,296 numbers — counting 0.) So the hardware provides for programs to operate in terms of as much as they wish of this full 4GB space as Virtual Memory, those parts of the program and data which are currently active being loaded into Physical Random Access Memory (RAM). The processor itself then translates (‘maps’) the virtual addresses from an instruction into the correct physical equivalents, doing this on the fly as the instruction is executed. The processor manages the mapping in terms of pages of 4 Kilobytes each - a size that has implications for managing virtual memory by the system.

http://www.aumha.org/win5/a/xpvm.php


Virtual Memory in UNIX:

Virtual memory is an internal “trick” that relies on the fact that not every executing task is always referencing it’s RAM memory region. Since all RAM regions are not constantly in-use, UNIX has developed a paging algorithm that move RAM memory pages to the swap disk when it appears that they will not be needed in the immediate future.
As memory regions are created, UNIX will not refuse a new task whose RAM requests exceeds the amount of RAM. Rather, UNIX will page out the least recently referenced RAM memory page to the swap disk to make room for the incoming request. When the physical limit of the RAM is exceeded UNIX can wipe-out RAM regions because they have already been written to the swap disk.
When the RAM region is been removed to swap, any subsequent references by the originating program require UNIX copy page in the RAM region to make the memory accessible. UNIX page in operations involve disk I/O and are a source of slow performance. Hence, avoiding UNIX page in operations is an important concern for the Oracle DBA.

http://www.remote-dba.net/op_unix_44_paging_algorithm_swap_disk.htm

Wednesday, November 21, 2007

Assignment 1

1. The most important program that runs on a computer. Every general-purpose computer must have an operating system to run other programs. Operating systems perform basic tasks, such as recognizing input from the keyboard, sending output to the display screen, keeping track of files and directories on the disk, and controlling peripheral devices such as disk drives and printers.
For large systems, the operating system has even greater responsibilities and powers. It is like a traffic cop -- it makes sure that different programs and users running at the same time do not interfere with each other. The operating system is also responsible for security, ensuring that unauthorized users do not access the system.
Operating systems can be classified as follows:
multi-user : Allows two or more users to run programs at the same time. Some operating systems permit hundreds or even thousands of concurrent users.
multiprocessing : Supports running a program on more than one CPU.
multitasking : Allows more than one program to run concurrently.
multithreading : Allows different parts of a single program to run concurrently.
real time: Responds to input instantly. General-purpose operating systems, such as DOS and UNIX, are not real-time.

Personal evaluation:
It tells about the uses of OS.

http://www.webopedia.com/TERM/o/operating_system.html

2. Two resons why a regional bank use 6 server computers than one supercomputers:
-it can perform faster
-give more benifits,or it has a high quality.