Question

In: Computer Science

System calls pass parameters to the kernel using one of three methods: in registers, in a...

System calls pass parameters to the kernel using one of three methods: in registers, in a block or table and the address of the block passed as parameter in a register, on the stack. Discuss the advantages and disadvantages of each.

Also, what does it mean when we say “a program is a passive entity while a process is an active entity”?

Also, in detail why does the Operating System switches the process from Running state to Waiting state when it issues any I/O operation.

Solutions

Expert Solution

1) System call:

A system call is an interface to the services of the OS. Application developers often do not have direct access to the system calls, but can access them through an application programming interface (API).

Passing Parameters:

There are 3 main methods.

(a) Parameters can be passed in registers.

Advantage: Easy and simplest method. Also direct way to pass parameters.

Faster. Can be immediately used.

Disadvantage: This is insufficient when there are more parameters than number of registers.

(b) Parameters can be stored in a block and the block address can be passed as a parameter to a register.

Advantage: When there are more parameters than registers, this method can be used.

Disadvantage: Limited to only Linux and Solaris.

(c) Parameters can also be pushed on or popped off the stack by the operating system.

Advantage: It do not limit the number or length of parameters passed. Can pass any number of parameters.

Disadvantage: Code becomes a bit more complex.

2) Program and Process:

Process:

A process is an instance of a computer program that is being sequentially executed by a computer system.

Process is an active entity as it is created during execution and loaded into the main memory.

Process is a dynamic entity.

Program:

A computer program is just a source code compiled into machine instructions, while a process is the actual execution of those instructions.

Program is a passive entity as it resides in the secondary memory.

Program is a static entity.

3) It is due to the Non-Preemptive Scheduling technique in OS.

Here there is no choice. A new process must be selected.

Once a process starts running it keeps running, until it either voluntarily blocks or until it finishes.

  Whenever the process requests access to I/O or needs input from the user it enters the blocked or wait state.


Related Solutions

Modify the bellow program by using only system calls to perform the task. These system calls...
Modify the bellow program by using only system calls to perform the task. These system calls are open,read,write, and exit .Use text and binary files to test your programs. #include <stdio.h> void main(int argc,char **argv) { FILE *fp1, *fp2; char ch, buf[20], *pos; int n; pos = buf; if ((fp1 = fopen(argv[1],"r")) == NULL) { puts("File cannot be opened"); exit(1); } fp2 = fopen(argv[2], "w"); while ((n = fread(pos, sizeof(char), 20, fp1)) == 20) { fwrite(pos, sizeof(char), 20, fp2); }...
Using Pass-by-Reference for Out Parameters Write a single function that counts the number of positive, negative...
Using Pass-by-Reference for Out Parameters Write a single function that counts the number of positive, negative and zero values in an integer array. Return the number of positive values, the number of negative values and the number of zero values. Use pass-by-reference to use parameters as “out parameter”: these are variables passed by reference into a function with the purpose of holding the result of the function after it terminates. Your function should have the following declaration: void countPosNegZero(int array[],...
Give four reasons why system calls are typically implemented using interrupts instead of function calls.
Give four reasons why system calls are typically implemented using interrupts instead of function calls.
Write a program calls each of the three methods described below and prints out the result...
Write a program calls each of the three methods described below and prints out the result of the two methods which return value reverse- a void method that reverses the elements of the array. Print the array before you call the method and after call the method. getMin- an int method that returns the smallest value in the array Sample output array: 22,34,21,35,12,4,2,3,99,81 array in reverse: 81,99,3,2,4,12,35,21,34,22 the smallest number is 2
(a) Solve the linear system Az = b using the following three methods: I. The GE+PP...
(a) Solve the linear system Az = b using the following three methods: I. The GE+PP algorithm for sparse (banded) linear systems, which is the default algorithm used by Matlab’s “\” operator when the matrix (call it Asparse) is of sparse type. You may find it easiest to set up the matrix using the spdiags command. II. The GE+PP algorithm for dense linear systems, again using “\”. Here, you need a dense version of A which you can obtain either...
Using the indicated parameters for each system element (P in, G1, L & G2) and with...
Using the indicated parameters for each system element (P in, G1, L & G2) and with impedances matched for each junction (node, Ni ) of this end-to-end system, compute a) the net linear system gain, b) the net system gain in dB, and c )the power levels (in dB) at each stage of this cascaded system (i.e. Pin, N1, N2, and P out). Pin=0.1 W, G1=400, L=2,000, G2=500
To evaluate the system parameters, one uses Monte Carlo methodology and simulates one of its vital...
To evaluate the system parameters, one uses Monte Carlo methodology and simulates one of its vital characteristics X, a continuous random variable with the density f(x) = 2/9 (1+x) if -1 < x < 2, otherwise 0 Explain how one can generate X, given a computer-generated Standard Uniform variable U. If U = 0.2396, compute X.
"Any intellectual activity involves the independent functioning of three neurological system". Explain with reference to PASS model.
"Any intellectual activity involves the independent functioning of three neurological system". Explain with reference to PASS model.
Describe the three basic methods for contructing a life table (2 main methods, one of which...
Describe the three basic methods for contructing a life table (2 main methods, one of which has 2 submethods). For each one explain how data are collected and entered into a life table. Identify a positive and negative aspect for each.
JavaScript Task Load three images of colorful fall leaves and using functions with parameters do the...
JavaScript Task Load three images of colorful fall leaves and using functions with parameters do the following. (Remember you can call the same function multiple times sending the function different values.) When you move the mouse over the first image, have the second image change to a pumpkin. When you move the mouse off of the first image, have the second image change back to the original leaves. When you move the mouse over the second image, have the third...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT