MCS-041 ASSIGNMENT SOLUTION (2018-19)

If you have any queries please leave a message here
Your Message
×


Question 1 :

A time sharing system is to be designed to support a large number of users. List all the considerations which influence the choice of the time slice. Justify each consideration.

Answer : - A time sharing system or Multitasking system allows many users to share the computer resources simultaneously. In other words, time sharing refers to the allocation of computer resources in time slots to several programs simultaneously. For example a mainframe computer that has many users logged on to it. Each user uses the resources of the mainframe -i.e. memory, CPU etc. The users feel that they are exclusive user of the CPU, even though this is not possible with one CPU i.e. shared among different users.

The time sharing systems were developed to provide an interactive use of the computer system. A time shared system uses CPU scheduling and multiprogramming to provide each user with a small portion of a time-shared computer. It allows many users to share the computer resources simultaneously. As the system switches rapidly from one user to the other, a short time slot is given to each user for their executions.

The time sharing system provides the direct access to a large number of users where CPU time is divided among all the users on scheduled basis. The OS allocates a set of time to each user. When this time is expired, it passes control to the next user on the system. The time allowed is extremely small and the users are given the impression that they each have their own CPU and they are the sole owner of the CPU. This short period of time during that a user gets attention of the CPU; is known as a time slice or a quantum.

The time-shared systems are more complex than the multi-programming systems. In time-shared systems multiple processes are managed simultaneously which requires an adequate management of main memory so that the processes can be swapped in or swapped out within a short time.

Advantages of Time-sharing operating systems :

Disadvantages of Time-sharing operating systems :




Question 2 :

a) List the conditions under which memory allocation decisions can delay the initiation or scheduling of a program.

Answer : -

Almost all processes alternate between two states in a continuing cycle, as shown in Figure given below :


CPU Scheduler

Whenever the CPU becomes idle, it is the job of the CPU Scheduler ( a.k.a. the short-term scheduler ) to select another process from the ready queue to run next.


Dispatcher

The dispatcher is the module that gives control of the CPU to the process selected by the scheduler. This function involves :




b) Consider the following set of processes with arrival time and CPU execution time given in milliseconds. A process with a larger priority number has a higher priority. If any assumptions made by you, state them.

ProcessArivel TimeExecution TimePriority
P10091
P22062
P33043
P43034
P56045

(i) Draw the Gantt charts illustrating the execution of these processes using the FCFS, SJF, Round Robin (with quantum = 2).

(ii) Also calculate the average turn around time, average waiting time, processor utilization and throughput for each of the algorithms mentioned in (i).

(i) Answer : -




(ii) Answer : -

First Come First Serve (FCFS)

Waiting Time = Starting Time - Arivel Time
Turnaround Time = Waiting Time + Execution Time

ProcessArivel TimeWaiting TimeTurnaround Time
P100(0 + 9) = 9
P22(9 - 2) = 7(7 + 6) = 13
P33(18 - 3) = 15(15 + 4) = 19
P43(15 - 3) = 12(12 + 3) = 15
P56(22 - 6)= 16(16 + 4) = 20

Average Waiting Time = (0 + 7 + 15 + 12 + 16) / 5 = 10
Average Turnaround Time = (9 + 13 + 19 + 15 + 20) / 5 = 15.2


Shortest Job First (SJF)

ProcessArivel TimeWaiting TimeTurnaround Time
P1017(17 + 9) = 26
P2211(11 + 6) = 17
P337(7 + 4) = 11
P430(0 + 3) = 3
P560(0 + 4) = 4

Average Waiting Time = (17 + 11 + 7 + 0 + 0) / 5 = 7
Average Turnaround Time = (26 + 17 + 11 + 3 + 4) / 5 = 12.2


Round Robin (RR)

ProcessArivel TimeWaiting TimeTurnaround Time
P1017(17 + 9) = 26
P2215(15 + 6) = 21
P339(9 + 4) = 13
P4311(11 + 3) = 14
P569(9 + 4) = 13

Average Waiting Time = (17 + 15 + 9 + 11 + 9) / 5 = 12.2
Average Turnaround Time = (26 + 21 + 13 + 14 + 13) / 5 = 17.4




c) Explain the trade-offs involved in choosing the size of a time slice for a round robin algorithm.

Answer : - Round robin is the scheduling algorithm used by the CPU during execution of the process . Round robin is designed specifically for time sharing systems . It is similar to first come first serve scheduling algorithm but the preemption is the added functionality to switch between the processes.

A small unit of time also known as time slice or quantum is set/defined. The ready queue works like circular queue. All processes in this algorithm are kept in the circular queue also known as ready queue. Each New process is added to the tail of the ready/circular queue.

By using this algorithm, CPU makes sure, time slices (any natural number) are assigned to each process in equal portions and in circular order, dealing with all process without any priority.


Pseudo Code :

CPU scheduler picks the process from the circular/ready queue, set a timer to interrupt it after 1 time slice/quantum and dispatches it.




Question 3 :

Describe the following disk scheduling policies: First Come First Serve (FCFS), Shortest Seek Time First, SCAN, C-SCAN, Look and C-Look. Show the disk arm movement and calculate the number of tracks traversed using all of the policies if the disk has 200 tracks and the requested tracks, in the order received, are 65, 48, 39, 08, 99, 164, 152, 38, 124.

Answer : -

First Come First Serve (FCFS) Disk Scheduling

It is the simplest Disk Scheduling algorithm. It services the IO requests in the order in which they arrive. There is no starvation in this algorithm, every request is serviced.

Disadvantages

Number of tracks moved by the head
= [(65 - 48) + (48 - 39) + (39 - 38) + (38 - 8) + (99 - 8) + (164 - 99) + (164 - 152) + (152 - 38) + (124 -38)]
= [17 + 9 + 1 + 30 + 91 + 65 + 12 + 114 + 86]
= 425


Shortest Seek Time First (SSTF) Disk Scheduling

Shortest-Seek-Time-First (SSTF) service all the requests close to the current head position and with minimum seeks time from current head position. It reduces the total seek time as compared to FCFS.

Disadvantages

Number of tracks moved by the head
= [(65 - 48) + (48 - 39) + (39 - 38) + (38 - 8) + (99 - 8) + (124 - 99) + (152 - 124) + (164 - 152)]
= [17 + 9 + 1 + 30 + 91 + 25 + 28 + 12]
= 213


SCAN Disk Scheduling

It is also called as Elevator Algorithm. In this algorithm, the disk arm moves into a particular direction till the end, satisfying all the requests coming in its path,and then it turns backand moves in the reverse direction satisfying requests coming in its path.

Number of tracks moved by the head
= [(65 - 48) + (48 - 39) + (39 - 38) + (38 - 8) + (8 - 0) + (99 - 0) + (124 - 99) + (152 - 124) + (164 - 152)]
= [17 + 9 + 1 + 30 + 8 + 99 + 25 + 28 + 12]
= 229


C-SCAN Disk Scheduling

In C-SCAN algorithm, the arm of the disk moves in a particular direction servicing requests until it reaches the last cylinder, then it jumps to the last cylinder of the opposite direction without servicing any request then it turns back and start moving in that direction servicing the remaining requests.

Number of tracks moved by the head
= [(65 - 48) + (48 - 39) + (39 - 38) + (38 - 8) + (8 - 0) + (200 - 0) + (200 - 164) + (164 - 152) + (152 - 124) + (124 - 99)]
= [17 + 9 + 1 + 30 + 8 + 200 + 36 + 12 + 28 + 25]
= 366


LOOK Disk Scheduling

It is like SCAN scheduling Algorithm to some extant except the difference that, in this scheduling algorithm, the arm of the disk stops moving inwards (or outwards) when no more request in that direction exists. This algorithm tries to overcome the overhead of SCAN algorithm which forces disk arm to move in one direction till the end regardless of knowing if any request exists in the direction or not.

Number of tracks moved by the head
= [(65 - 48) + (48 - 39) + (39 - 38) + (38 - 8) + (99 - 8) + (124 - 99) + (152 - 124) + (164 - 152)]
= [17 + 9 + 1 + 30 + 91 + 25 + 28 + 12]
= 213


C-LOOK Disk Scheduling

C Look Algorithm is similar to C-SCAN algorithm to some extent. In this algorithm, the arm of the disk moves outwards servicing requests until it reaches the highest request cylinder, then it jumps to the lowest request cylinder without servicing any request then it again start moving outwards servicing the remaining requests.

It is different from C SCAN algorithm in the sense that, C SCAN force the disk arm to move till the last cylinder regardless of knowing whether any request is to be serviced on that cylinder or not.

Number of tracks moved by the head
= [(65 - 48) + (48 - 39) + (39 - 38) + (38 - 8) + (164 - 8) + (164 - 152) + (152 - 124) + (124 - 99)]
= [17 + 9 + 1 + 30 + 8 + 156 + 12 + 28 + 25]
= 286




Question 5 :

Discuss in detail the features, Process management, Memory management, I/O Management, File management and Security and Protection in Android Operating System (latest version).

Answer : -

Process Management

In most cases, every Android application runs in its own Linux process. This process is created for the application when some of its code needs to be run, and will remain running until it is no longer needed and the system needs to reclaim its memory for use by other applications.

An unusual and fundamental feature of Android is that an application process's lifetime is not directly controlled by the application itself. Instead, it is determined by the system through a combination of the parts of the application that the system knows are running, how important these things are to the user, and how much overall memory is available in the system.

To determine which processes should be killed when low on memory, Android places each process into an "importance hierarchy" based on the components running in them and the state of those components. These process types are (in order of importance) :

1. Foreground Process - A foreground process is one that is required for what the user is currently doing. Various application components can cause its containing process to be considered foreground in different ways. A process is considered to be in the foreground if any of the following conditions hold :

There will only ever be a few such processes in the system, and these will only be killed as a last resort if memory is so low that not even these processes can continue to run. Generally, at this point, the device has reached a memory paging state, so this action is required in order to keep the user interface responsive.

2. Visible Process - A visible process is doing work that the user is currently aware of, so killing it would have a noticeable negative impact on the user experience. A process is considered visible in the following conditions :

The number of these processes running in the system is less bounded than foreground processes, but still relatively controlled. These processes are considered extremely important and will not be killed unless doing so is required to keep all foreground processes running.

3. Service Process - A service process is one holding a Service that has been started with the startService( ) method. Though these processes are not directly visible to the user, they are generally doing things that the user cares about (such as background network data upload or download), so the system will always keep such processes running unless there is not enough memory to retain all foreground and visible processes.

Services that have been running for a long time (such as 30 minutes or more) may be demoted in importance to allow their process to drop to the cached LRU list described next. This helps avoid situations where very long running services with memory leaks or other problems consume so much RAM that they prevent the system from making effective use of cached processes.

4. Cached Process - A cached process is one that is not currently needed, so the system is free to kill it as desired when memory is needed elsewhere. In a normally behaving system, these are the only processes involved in memory management: a well running system will have multiple cached processes always available (for more efficient switching between applications) and regularly kill the oldest ones as needed. Only in very critical (and undesireable) situations will the system get to a point where all cached processes are killed and it must start killing service processes.

A process's priority may also be increased based on other dependencies a process has to it. For example, if process A has bound to a Service with the Context.BIND_AUTO_CREATE flag or is using a ContentProvider in process B, then process B's classification will always be at least as important as process A's.


Memory Management

The Android Runtime (ART) and Dalvik virtual machine use paging and memory-mapping to manage memory. This means that any memory an app modifies—whether by allocating new objects or touching memory-mapped pages — remains resident in RAM and cannot be paged out. The only way to release memory from an app is to release object references that the app holds, making the memory available to the garbage collector. That is with one exception: any files memory-mapped in without modification, such as code, can be paged out of RAM if the system wants to use that memory elsewhere.


File Management

Most of the Android user are using their Android phone just for calls, SMS, browsing and basic apps, But form the development prospective, we should know about Android internal structure. Android uses several partitions (like boot, system, recovery , data etc) to organize files and folders on the device just like Windows OS.

There are mainly 6 partitions in Android phones, tablets and other Android devices. Note that there might be some other partitions available, it differs from Model to Model. But logically below 6 partitions can be found in any Android devices.

Also Below are the for SD Card File System Partitions.


Security and Protection



ABOUT US

QuestionSolves.com is an educational website that helps worldwide students in solving computer education related queries.

Also, different software like Visual Studio, SQL Server, Oracle etc. are available to download in different versions.

Moreover, QuestionSolves.com provides solutions to your questions and assignments also.


MORE TOPIC


Windows Command

UNIX Command

IGNOU Assignment Solution

IGNOU Question Paper Solution

Solutions of Different Questions


WHAT WE DO


Website Devlopment

Training

Home Learning

Provide BCA, MCA Projects

Provide Assignment & Question Paper Solution


CONTACT US


Follow Us