3. Operating System – CPU Management

CPU Management – A step towards Process Management


By Shritam Bhowmick
Web Application Penetration Tester
LinkedIn: https://www.linkedin.com/profile/view?id=281014248&trk=nav_responsive_tab_profile
Academia: https://independent.academia.edu/ShritamBhowmick
Facebook: https://www.facebook.com/coded32

Last post, I talked about the coverage of the series on operating system and the introductory post with the importance of operating system, as well as defining the operating system. In this post, I’d discuss CPU management and hence go closer into process management. The CPU is known by Central Processing Unit and it is hence obvious CPU is a process manager of the computer system. It processes the given data into desired output which is useful for the user. The process which takes place in the CPU should be in the main memory, that is the data which is to be executed via processing should be in the main memory (Random Access Memory or RAM).  A multi-user system uses processes, and a process does not mean a multiple CPU handling these processes, it means that the processes are handled by the same CPU but with optimization in time and processing efficiency. The data provided by the user is fed to the CPU which is a ‘Job’, this Job needs processing to be done and hence result in execution in the CPU, the Jobs require the dependency data to be present in the main memory. Jobs are the tasks which the CPU has to undertake in order to process them, and then execute and write the results to the secondary devices (special I/O devices as discussed in y previous posts) or directly as a output to a video terminal, or printer, etc.

The terms which would be required for CPU management are:

  1. Waiting Time
  2. Turnaround Time

What is Waiting Time?

The gap in time between the given job for execution to the CPU and the actual time when the CPU begins to execute the given job is known as the waiting time. Or in other words the time the processing for the given job to be executed/processed remains in the ready queue for the CPU to begin processing or executing is termed as the waiting time.

Let t(0) be the time the user has given a certain job for processing or execution to the CPU. And let the actual time when the CPU begins processing/executing the given job be t(i). The time difference between t(i) and t(0) i.e: t(i) – t(0) = t(w) {Waiting time} is termed as the waiting time. So the equations are:

T(i) - T(0) = T(w)


  1. T(i) = Time at which the user had supplied the job for processing or execution to the CPU.
  2. T(0) = Time at which the CPU actually starts processing or execution of the supplied job.
  3. T(w) = Waiting Time.

Now for the CPU to give an output, there must be some time taken by the CPU in order to process the job. This time on a timeline of the whole processing from job given, to job initialization by the CPU and the output could be shown as below:


Waiting Time Demonstration


As shown, the processed job by the CPU is at the last entry which is marked as T (p), this would be the output time stamp when the job is done by the CPU.  Now, the concept of turnaround time hops in.

What is Turnaround Time?

The time taken for a job to complete it’s processing or execution from the point of the job submission to the CPU until it’s processing has been completed is termed as turnaround time. Or in other words, turnaround time is the total time taken between the submission of a program/process/thread/task  for execution and the return of the complete output to the user.

Now, as we had assumed the time stamp when the job is completed to be T (p), the turnaround time would be as following described by the equation:

T (t) = T (p) - T (0)


  1. T (t) = Turnaround Time
  2. T (p) = Processed or executed job by the CPU returned to the user or written in the special I/O device or outputted.
  3. T (0) = The time stamp when the user submitted the job/task to the CPU.

Diagrammatically, it would be:

Turnover Time

Having said that, the users would always want the waiting time and the turnaround time to be minimum in order to accomplish processing and outputting of the given jobs. But the CPU handles multi-jobs simultaneously and hence this isn’t possible or realistic. Jobs should be executed in first come first served (FCFS) basis and hence certain waiting time has to be allotted to the incoming jobs. Let’s assign these incoming jobs to be:

J1, J2, J3, J4 which would be incoming from ascending order, i.e: 1st J1 is fed to the CPU, then J2, J3 and finally J4. Hence the processing by the CPU should also be in accordance. That is if FCFS (First Come First Served) method is applied, J1 should be undertaken first and then the rest and hence the processing of J1 will be first then the rest. Applying that:

J1 = 15 time units of execution.
J2 = 8 time units of execution.
J3 = 10 time units of execution.
J4 = 3 time units of execution.

The jobs have been assigned with there respective time units of execution, that is each job is actually undertaken by the CPU at a certain time lapse, which until then it’s a waiting time. Assuming the jobs have arrived to the CPU progressively as J1, J2, J3 and then J4, I draw a general timeline:


Calculate Average Waiting Time


The above diagram shows the calculation part of the average job wait time. The calculation is simple, ignore the numbers and because it’s FCFS, start from ‘0’ for the Job 1 since Job 1 never waited, the others were in queue. The numbers given are for execution time that is the time interval the job took to get over with execution and hence the waiting time for each would be calculated as:

W (j1) = 0
W (j2) = 0 + 15 = 15
W (j3) = 15 + 8 = 23
W (j4) = 23 + 10 = 33

Total Wait time = 71

The last 3 units of time wasn’t a wait time, it was the time taken for the 4th job to get over with execution, the 4th job already waited for 33 units of time for it’s turn to get execution scheduled. This process undertaken by the CPU is called Job Scheduling or simply Scheduling. That comes deep later, but to calculate the average waiting time, I need to consider all the jobs which are 4 items so:

71/4 = 17.75 is the average waiting time i.e: T (wa). Hence, T (Wa) = 17.75 time units for the above example on wait time average. Now, changing the sequential order of the incoming jobs. The CPU has no control over the incoming of the jobs, but what the CPU has control of is the order in which the jobs will be given a priority for execution. This could be decided by the CPU. So, consider the order below for jobs: (considering the same queue of jobs, the situation here is re-scheduling the jobs

J4 = 3 units of time
J2 = 8 units of time
J3 = 10 units of time
J1 = 15 units of time

In this case, the execution time remains the same, however the jobs are re-shuffled according to the CPU’s preference and the priority in taking up the job. Previously, the jobs were taken first come first served basis, but here even though the jobs arrived sequentially, the CPU has the authority and control of the execution land the processing of the jobs which were given by the user. The CPU decides to execute the job in the order such that J4 was executed first, next was J2, and then J3 and finally J4 was executed.

Considering the above situation, I now wanted to determine the average waiting time for such a schedule prescribed by the CPU because the CPU has the control on the scheduling part but does not have the control over the incoming jobs. To draw a rough sketch of just occurrences with a job execution and waiting timeline:


Scheduling without FCFS. Rescheduling with CPU’s control over Scheduling


Considering the image below I had drawn (MS paint, mind not!), the time taken for execution of the jobs in previous scenario were the same, but the scheduling was done by the CPU without FCFS method but taking in priority to which jobs has to be executed first to perform optimization. The magic happens here. Now if we calculate the waiting time:

W (J4) = 0 (since it arrived first)
W (J2) = 0 + 3 = 3 (since J2 had to wait for 3 units of time because 3 units of time were wasted {rather not!} in execution of job J4)
W (J3) = 3 + 8 = 11 (since J3 had to wait until J2 was finished executing with time lapse of 8 units)
W (J1) = 11 + 10 = 21 (since J1 had to wait for J3 to finish up with execution with time lapse of 10 units)


W (J4) = 0
W (J2) = 3
W (J3) = 11
W (J1) = 21

Total Wait Time = 35 time units

Now, if I calculate the average waiting time T (Wa) for this, that is 35/4, it comes to 8.75 time units. So:

T (Wa) = 8.75

which is far lesser in waiting time than the previous scenario. Calculating the optimization which had occurred here and the difference, our previous FCFS achieved 17.75 of waiting time, and this scheduling by the CPU achieved 8.75. The difference in wait time optimization being:

17.75 - 8.75 = 9.00 time units

A budget of total 9 time units.  So we find that just by changing the order, the same jobs were optimized. The average waiting time were reduced drastically so naturally the CPU would now prefer the second type of scheduling rather than the first scheduling. The user wold always prefer the first scenario but the CPU won’t allow that because it has to follow optimization rules. In the second scenario, there is a pattern why the average waiting time were drastically reduced. This is achieved by executing the jobs first which take lesser time for execution because the next queue of jobs will have to ‘wait’ lesser and hence optimization could occur.There are various objectives which could be achieved, the objective achieved here was to minimize the average waiting time for the jobs together to be finished in an optimized way.

So that’d be the very touch towards process management in this post. Next post, I’d bring some more fruits to the blog. The concepts of process management is vast and does not end with this basic post.  To keep updated if you like these posts, subscribe via mail or keep visiting the blog. Cheers out!

2. Operating System- Importance of Operating System

The Importance of an Operating System

By Shritam Bhowmick
Web Application Penetration Tester
LinkedIn: https://www.linkedin.com/profile/view?id=281014248&trk=nav_responsive_tab_profile
Academia: https://independent.academia.edu/ShritamBhowmick
Facebook: https://www.facebook.com/coded32

Before I get to the importance of the operating system, I must define what an Operating system is, the standard definition of an operating system and then deduce it’s importance respectively. In order to define operating system, one must understand that there is a distinction between software components and hardware components of a computer. The computer itself cannot accomplish everything, it needs support from the hardware as well as support fro the hardware in order to accomplish the task it has been assigned to do. This applies both to super computers, personal computers, Macs and any devices which fall in the realm of being called as a computer, including basic calculators, watches, mobile devices and any other gadget which use hardware components as well as pre-made integrated software components. Different files which are inter-related and accomplish a certain set of task makes up the operating system. These files are system level files which does scheduling, interrupting, data transferring and managing the flow of data and is low level software component of the computer itself. And hence he standard definition of an operating system would be:

An operating system is a set of program files which controls the resources of the computer system and allows the communication of hardware components of a computer to the software components of the computer system. Operating systems provides access to computer services which is possible only via working of both the hardware components and the software components.

The operating system is like a resource manager. It handles decision making and interruption. It manages the time for tasks to occur. So, what are the resources of the computer system?

  1. CPU – Central Processing Unit of the computer system – performs execution of a program operation. The complied program or the executable program has to be executed by the CPU to give the users the desired result. The program is taken from the secondary storage drive to the main memory. The CPU cannot access directly the secondary storage memory. The program must be brought from the secondary memory to the main memory for execution. Even the data to be processed has to be brought from the secondary memory to the main memory. The data which is to be executed must reside in the main memory for execution and hence cannot reside in the secondary memory for execution. Therefore first resource for the computer system is the CPU, the central processing unit.
  2. The Main Memory – When a piece of program has to be executed by the CPU, this data or program must reside in the main memory, hence if there is a multi-user system where more than one user program has to be executed simultaneously. To manage these programs for more than one user is a required responsibility of the operating system.
  3. Secondary Storage – This consists of the hard disks, magnetic tapes, floppy disks, CD-ROM drives and USB storage devices. The way the main memory is accessed and the way in which the secondary storage are accessed are different. There are different types of secondary storage as discussed above and hence the characteristics of these storage are different and never uniform. Accordingly, the different secondary storage devices are to be accessed are different. Main memory is accessed directly by the CPU, but secondary storage are not accessed directly by the CPU. For the CPU to access the secondary memory in case required data has to be fetched into the the main memory for execution of a certain program, the CPU has to consult or instruct the device driver. The device driver would look for the required files, data or programs which the CPU needs for execution, fetch it and bring them back to the CPU for such an execution to occur. Hence the way main memory is accessed and the way the secondary storage is accessed are different.
  4. Input/Output Devices (I/O devices) – These are the devices through which the user would feed the data, write a data and will interact physically such as keyboard, mouse, etc. These devices are the input devices. When the user wants to get the data as a output in visual form, such as video terminal, a printer, etc. All of them are output devices. The secondary storage could also be considered as a I/O device because a data file processed normally resides in the secondary storage, when a program is executed, the program opens the data file which is stored in the secondary storage device, reads the data file, and after reading it closes the file which means it also inputs the data but not through the keyboard but through the hard-disk or the secondary storage. Similarly when processing data, the output is stored in the secondary storage. So considering this, the secondary storage has to be considered as a special type of input/output devices.

So, there are majorly four types of resources which the computer  system has. These are as discussed above, namely, the CPU, the main memory, the secondary storage and the input/output devices. The main memory and the secondary storage are types of memory modules and could be termed as ‘memory devices’ which the computer system has the responsibility to manage as ‘memory management’. Similarly, the computer system has to manage the secondary storage and the input/output devices and the secondary storage is treated as special kind of input/output components. The computer system requires to efficiently manage all these resources for providing time to multiple users or clients. These resources are confined in a single system but in modern operating system this isn’t the case. The advancement of information distribution. When a multiple computers are considered with interconnection with the help of networking can hence accomplish distributed working in order to give relevant information to the users. Even if the network fails, the isolated computers would still work. Information could be transferred from one computer to a different computer at a different geographical location through networking and hence distribution of information, the concept of distributed computing system comes.


Distributed Computer System


Advantages of distributed computer systems:

  1. The information storage required is minimal because all the information is not required to be in single computer system. It could be distributed among different computers. The information is broken to number of pieces and stored on different isolated computers which are inter-networked.
  2. Having such a distributed computer environment prevents duplication of information. It prevents multiple files (data duplication) which isn’t desired. This increases the efficiency. Hence efficient utilization of resources. The modern operating systems caters this efficiency management.

Hence the responsibilities of the operating system includes controlling the hardware components, the resources which are provided to the computer system, to routinely schedule the tasks carried out by the computer system and hence along with merging the functions of hardware and software provide computer based services to the users of the computer system. Now, that we are aware of certain responsibilities of the operating system, we must enlist some of the important aspects of an operating system. They are as follows:

1. It moderates the relationship between the computer and its peripherals.

2. It helps in the management of files,- copying, deleting, moving of files from one storage location to the other.

3. It encourages the memory for its efficient usage and thus adding the speed of the computer.

4. It manages the activities of the processor in terms of job execution according to the priority of arrival ,of jobs.

5. It informs the user of nay hardware or software error.

6. It makes communication between the computer and the user or the operator possible.

(Reference: http://thecomputersystem.blogspot.in/2009/06/importance-of-operating-system.html)

In order to understand this perspective more deeper, consider reading the next concurrent posts about operating system. The posts would include process management, cache memory, deadlocks and the coverage I had put in the previous post. I shall take a leave and the next post would be on CPU management.


1. Operating System – An Introductory Post on coverage.

An Introduction to Operating Systems

By Shritam Bhowmick
Web Application Penetration Tester
LinkedIn: https://www.linkedin.com/profile/view?id=281014248&trk=nav_responsive_tab_profile
Academia: https://independent.academia.edu/ShritamBhowmick
Facebook: https://www.facebook.com/coded32

Hi, this semester I had something new to discuss. The subject was Operating System, and I find it a pleasure writing all of the achieved knowledge through this blog post. This post would be the introductory post since there is a lot to cover. And because there is a lot to cover, here I would go in accordance with clear mentionables and hence cover only the important aspects. The coverage will encircle all the syllabus. To let you know the university (WBUT 2014) has prescribed the following as the syllabus:

  1. Importance of OS.
  2. Basic concepts and terminology
  3. Types of OS
  4. Different views
  5. Journey of a command execution
  6. Design and implementation of OS
  7. Process: Concept and views
  8. OS view of processes
  9. OS services for process management
  10. Scheduling algorithms,
  11. Performance evaluation
  12. Inter process communication and synchronization
  13. Mutual exclusion
  14. Semaphores
  15. Hardware support for mutual exclusion
  16. Queuing implementation of semaphores
  17. Classical problem of concurrent programming
  18. Critical region and conditional critical region
  19. Monitors
  20. Messages
  21. Deadlocks
  22. Resource manager
  23. Memory management
  24. File management
  25. Processor management
  26. Device management
  27. Security and protection
  28. Authentication, protection and access control
  29. Formal models of protection
  30. Worms and viruses.
  31. Multiprocessor system, classification and types
  32. OS functions and requirements
  33. Introduction to parallel computing
  34. Multiprocessor interconnection synchronization.
  35. Distributes OS – rationales
  36. Algorithms for distributed processing
  37. Introduction to Unix OS/DOS (case study)

All of the above topics are a standard evaluation of the syllabus and the topics marked are to be covered. The first topic is importance of OS and shall be discussed from the next post. It has come to my attention that universities rather Indian Universities are not much conceptual on drafting out syllabus. They care only to finish a heap of things without any real conclusion on the achieved skill-set. However, I choose to go the other way round and make things better with my own research and dedication because I am interested in such topics and college degree doesn’t matter much to me. The degree which is fetched might be useful for industrial jobs, but these jobs are often versatile on different things and the employee themselves need to be trained, fed, kicked and reduce the possibility of invention. This in turn re-invents the wheel of ultimate progression and limits the imaginary thoughts which could be turned into an invention and discovery.

As for this post is concerned, the coverage of the syllabus laid down by WBUT has been covered and hence I shall proceed to the next post in continuation to this post on the topic for ‘Importance of OS’. Because without really knowing why we need operating system, we would really be lost onto the topics. Feel free to navigate along the ‘categories’ to discover new contents added to ‘Operating Systems’. I shall post when time permits me and would share the additional resources if available any. I had planned to cover all the topic in each post for these to go ahead and leave a mark on a good outline coverage of all the topics. Probability of the questions asked and their answers will be also covered. An analysis from the previous year questions would also be sorted out and hence provide a flexible way to deduce the questions for the upcoming years. Since the year of writing these posts is 2014, it is the duty for other academic students to share the resources and these posts to others who shall be in need and had opted for the same university and has these topics to be covered. I shall take a leave now from this post and move along to the next posts which are due to come.



ISAD – Information System Analysis and Design.

So, the bitter truth is I really had not been prepared for ISAD, a part of BCA academic course. I had to go check what had been on the syllabus to make myself accented towards ISAD. I found that most of the topics had been summoned from the earlier dose of business system and applications. I quickly researched some of the topics I could study and mywbut.com came very handy with resourceful of materials. I knew I could get some of the topics fetched from this site which prepared the notes already. I am just pushing my information on the topics I know about because not all of the contents could be grabbed from this site alone. There are other resources as well, I will share them after I finish off my content on this. This post is to supposed be updated when I am updated. Again, you cannot get ‘all’ on this post itself. If you are specifically doing your academic kung-fu, this is not the best place. I write my research and personal papers here which might be found useful at some point. This doesn’t mean you end and hopefully do your part.

There are these topics that I see i can get my hand as on :

  1. Software Development Life Cycles – All those old bees. Namely Waterfall model, Spiral model, Incremental and you name it! there would be more…
  2. Feasibility Studies. – I am really not aware of this. What this was suppose to mean? I have to research, and let’s see what I get!
  3. Requirements Determination – em, I can just imagine there are requirements of some sort… I had been on pentesting; this is not majorly what I do (academics!).
  4. Logical Design – Falls in System Design, we will get on all that later.
  5. Physical Design – Falls in System Design.
  6. Program Design – In System Design.
  7. Risk and Feasibility Analysis – .. [redacted]

This post has been redacted from continuation due to time lack (the post was maintained for further study but due to the lack of time, the post is discontinued ..). See you another time, or catch the section which are available. Some good resources to look into are:

Tricks to get maximum:


Tricks to get paper and the notes:


You’ll need registration although. You might also find this beneficial:


But I doubt the above link would be much beneficial. If that doesn’t work, get here:


because if I change my mind and find some spare time, I’d share it here. This can/will happen if motivated enough. Go through my other posts on 3rd semester if needed. All the 2nd semester posts are redacted due to lack of maintenance and time management.



A Perfect example for HTML 4.01 forms.

HTML 4.01 is used widely and forms are everywhere. This isn’t HTML5 which makes things easy. Forms had been a part of the HTML specification and after years of use, it has dominated for day to day web-page creation to provide the flexibility of the users to submit there requests using HTTP protocols. Here’s is a perfect example for demonstration:



This is a HTML form demonstration:

<html lang="en">
        <title> Form </title>

        <p> This is a HTML 4.01 form demonstration <br> </p>

        <form action="#" method="POST">
                <td> First Name </td>
                <td><input type="text" name="firstname" id="firstname"/></td>
                <td> Last Name </td>
                <td><input type="text" name="lastname" id="lastname"/></td>
                <td><input type="password" name="passwd" id="passwd"/></td>
                    <input type="radio" value="male" name="gender"/>Male
                    <input type="radio" value="female" name="gender"/>Female
            <p>Demonstration for Radio Buttons<br/></p>
                <td valign="top">Age Range</td>
                    <input type="radio" value="0" name="age" />Age Under 18<br/>
                    <input type="radio" value="1" name="age" />Age 18+<br/>
                <td valign="top">Hacks you'd like</td>
                    <input type="checkbox" value="Web Application Pentest" name="webapp"/>Web Application Penetration Test<br/>
                    <input type="checkbox" value="Network Intrusion" name="networkint"/>Network Intrusion<br/>
        <p>Your selection of food items for the hack today!<br/></p>
            <form action="#" method="POST">
                <select name="food" size="3" multiple="multiple">
                    <option value="continental">Continental</option>
                    <option value="thai">Thai</option>
                    <option value="indian">Indian</option>
                    <option value="afgan">Afganisthani</option>
                    <option value="chinese">Chinese</option>
                    <option value="japanese">Japanese</option>
                <td><input type="reset"></td>
                <td><input type="submit" value="Send Information"/></td>
        </table> <br/>

That was a beautiful HTML 4.01 code, this is least required for web-development. Apart from web-development, I had posted this here because familiarity with web-page coding is minimal requirement for any serious web application penetration tester. Remember, this blog belongs for web application penetration testing and not for web-development. The minimal requirements needed for web-dev is mentioned in this blog (look at the various sections in this blog). Apart from everything else, I had kept the code clean using style tables which has three elements:

1.) Table Tag
2.) Table Row
3.) Table Data

Table columns are not needed at this point because there are no columns which could be required for information retrieval from the user in that representative arena. However, if one argues the web-dev approach for some unknown reason, this could be accomplished. The point is to show for HTML 4.01 forms work and their use. The ‘#’ on the action attribute denotes that we really do not have anything processed at the moment. A back-end language such as PHP, ASP, etc helps. That apart, the form uses ‘POST’ as HTTP method or verb for carrying out the information to the URL mentioned in the ‘action’ attribute. Below is a snippet of how the browser renders the code:


HTML 4.01 Form

HTML 4.01 Form


This is something neat. The form demonstrates:

  • Radio Buttons
  • Check Buttons
  • POST submission
  • Table Rows
  • Reset Feature

The code be useful for those willing to know the basics of web-page on HTML 4.01 development prior to taking up web application pentest seriously. This not only assists in enumeration and knowing what the application does but also eliminates the negativity of false positives because we are now more precise about the application and it’s usage.