Thursday, December 13, 2007

Case Study: Memory Management in Linux

To highlight the concets presented in this chapter, we end with a more specific example of how memory managed in the Linux operating system. Although Linux memory management has many features in common with UNIX, it has some unique characteristics, and it is quite complex.


Virtual Memory in Linux managed using a three-level table hierarchy, which acoomodates both 64- and 32-bit architectures. For the example show in Figure 3.18, each virtual address is made up of four filds, which are used by the Memory Manager to locate the instruction or data requested:


Main Directory Middle Directory Page Table Directory Actual Page Offset

Figure 3.18 refers to the following virtual address:

Job: 1 Page Table: 3 Page: 2 Line:214

Each job has its own entry in the main directory, which has pointers to each job's middle director. A job's middle directory contains pointers to its corresponding page table directories. In turn, each page table directory has pointers to the actual pages, as shown in Figure 3.18. Finally, the page offset field is used to locate the instruction or data within the requested page (Line 214).



Consider the case where main memory consists of 64 page frames and Job 1 resists 15 page frames. The buddy algorithm first rounds up the request to a power of 2 ( in this case 2 to the 4, which is 16). The group of 64 page frames is divided into two page frames that can satisfy the request, so the job's pages are copied into the page frames as shown in Figure 3.19(a). When job 2 requests 8 page frames, the second page up to 16 page frames is divided in two and the lower half is given to Job 2, as show in Figure 3.19 (b).


When Job 2 releases its page frames they are combined with the upper 8 page frames form a group of 16 page frames, as shown in Figure 3.19(c).


The Page replacement algorithm used by the Linux is an expanded version of the clock algorithm presented in the page replacement policies section of this chapter. Instead of using a single reference bit, Linux uses an 8-bit byte to keep track of a page's activity, which is referred to as its age. Each time a page is referenced, this age variable is incremented. Behind the scenes, at specific intervals, the Memory Manager checks each of use age variables and decreases their value by one. The result of this interaction is it, if a page is not referenced frequently, then its age variable will drop to zero and will be a good candidate for replacement if a page swap is necessary. On the other hand, a page that is frequently used will have a large age value and will not be a good choice for replacement. Therefore, we can say that Linux uses a form of least frequently used (LRU) replacement policy.

Thursday, November 22, 2007

2. Two Reasons why regional bank decided to buy 6 servers instead of 1 supercomputer:

  1. it can save investments and avoid any lost with only one computer running.
  2. it can have at least 3 or 4 computers running when 2 or 3 computers have its maintenance.

Operating System News

Leopard will open the Mac OS X floodgates (and embarrass Microsoft)

As many of you are aware, I think Windows Vista is a blunder. And with its annoying UAC system and horrifically slow operation, it won't take long before the majority of home users agree with me. If the recent figures showing Mac OS X is already gaining market share is any indication of the future, look for Leopard to outsell Vista by a staggering margin.
Simply put, Mac OS X Leopard is one of the most significant operating system achievements we have witnessed in years. Not only does it add functionality that Microsoft could only have dreamed of, it does so in a snappy environment that doesn't annoy you with pop-ups asking for permission or all of those security threats we have come to know (and hate) in Windows.
But my belief that Vista will soon bow to Leopard goes far beyond the operating system itself. In fact, the major reason Vista will succumb to Mac OS X has little to do with Apple, but quite a bit to do with Microsoft's current focus. Regardless of where you stand on the issue, one thing is abundantly clear: Microsoft fears Google and is doing everything it can to become the Google slayer instead of competing in its core business--software.
The company is on a slippery slope, and to be quite honest, I don't think it can get off too easily.

Source: http://www.news.com/