Monday, 12 June 2017

Fixed partitioning in operating system

 

Main memory in a computer is a very useful resource. It's something which is needed by each and every process at some point in time. In this post, we will discuss a technique which was used to assign memory to processes. But as always we will not directly jump into the discussion of what is fixed partitioning.
We will go step by step and find out how reach fixed partitioning? What made us opt for fixed partitioning?

So when main memories were not in existence we were using relays and delay lines for main memory functions. But the problem with these devices was that the devices would reproduce data only in the order in which the data was written into it. This made it very difficult to access the data randomly.

History of main memory:

Even if you want to read the end of the data you were supposed to make a sequential go through the data to reach the end. This problem leads to the discovery of drum memory, but to retrieve the data efficiently we were supposed to know the physical layout of the drum. So even this was not so popular.
Drum memory
Soon there was an advancement of technology and with transistors, people started making low memory high-speed devices such as registers. But registers at that time were not like we see them today. They were large and were very costly. So could not be used for a large amount of data. 

The first practical form of random-access memory was the Williams tube starting in 1947. It could store the data as electrically charged particles on the face of cathode ray tube(CRT). The electron beam of CRT could read and write the spots on the face of CRT in any order, so it was random. And that's where the first random access memory was built.
The capacity of the Williams tube was a few hundred to around a thousand bits, but it was much smaller, faster, and more power-efficient than using individual vacuum tube latches. After few more years, we had a fully randomised access memory which was much more efficient.

Fixed partitioning:

After the invention of main memory, the next challenge was, how to use it. As there are many processes in the memory it's very obvious that the memory allocation was needed. So fixed partitioning was introduced. 
In this technique, our main memory was divided into unequal parts. If our memory was 10 MB, the division was something like 1 MB, 2 MB, 3 MB, 4 MB. 

The reason for this kind of division was depending on the sizes of the processes. Since processes were of different sizes so were the divisions. The following diagram shows fixed partitioning.
Whenever a process makes a request the operating system looks into the primary memory and finds out the appropriate hole for it. How it finds out the appropriate hole is a different issue and we will look into that in some other tutorial. But assume it somehow finds out a correct spot for the process.

But the problem comes in when there is memory wastage. It's very difficult to find a slot which of the same size as that of process size. Most of the time it is either larger or smaller. This leads to a very big problem called as internal fragmentation.

To illustrate this problem let's assume all the above three slots of memory are occupied and now another process of size 1 MB comes in. We have no choice but to allocate it the 4 MB slot. This leads to wastage of 3 MB. This 3 MB cannot be occupied by any other process, even if it is of size <= 3 MB.
Process allocation in fixed partitioning

This was a major drawback of fixed partitioning and a major reason for its rejection. There are few more drawbacks of fixed partitioning.

  • Processes were not allowed to expand over the partition area.
  • The size of the processes was limited by partition sizes.
  • It suffered from internal and external fragmentation.
  • The degree of multiprogramming was limited.  
The reason for limited multi-programming is that it could only allow that many numbers of processes as there are a number of slots or partitions. Even if we have memory left because of internal fragmentation still we could not load more processes into the memory.

This was all about this topic. As always if you like the post, share it. If you have any queries, or you want to suggest something you can always ping me on Facebook or mention in the comments section below. I will be happy to help. You can follow me on Facebook or google+. Don't forget to follow the blog post.

Thank you!