What is a trap instruction? Explain its use in operating systems.
A trap instruction is a procedure call that synchronously transfers the control. A trap is an exception. Trap is reported immediately following the execution of the trapping instruction. A trap can be used to call operating system routines or to catch arithmetic errors. Example: -------- division by zero exception
1. The instruction TRAP x25 causes the PC to be loaded with the memory address: a. x0025 b. x2500 c. the contents of x0025 d. x0250 2. The instruction TRAP x23 at location x4232, causes R7 to be loaded with: a. x4232 b. x4233 c. contents of x4232 d. contents of x4233 4. The execution of the JSR instruction at location x4202, causes R7 to be loaded with: a. x4200 b. x4201 c. x4202 d. x4203 5. Which instruction in...
Why is a specific TRAP instruction needed to implement syscalls (instead of just using the same instruction that is used for regular function calls)? Then describe in detail the steps taken by the processor when it executes the TRAP instruction.
When a process executes a TRAP or is interrupted, the operating system uses a separate stack located in memory unavailable to user processes to execute any operating system code rather than the stack of the current process. Why might operating systems designers select this type of implementation?
Answer the following questions: a) What is the relationship between operating systems and computer hardware? b) What are the four basic function modules of an operating system? c) Differentiate between an abstract resource and a physical resource. Give two examples of each. d) Briefly describe the differences between an interrupt and a trap.
Various computers and operating systems in the past have used separate instruction and data spaces, allowing up to 2k program addresses and also 2k data addresses using a k-bit address. For example, for k=32, a program could access 4GB of instructions and also 4GB of data, for a total address space of 8GB. Using a scheme like this it is impossible for a program to overwrite itself. How could the operating system load programs into memory?
(Operating Systems Question) During the life time of a process, it operates in one of the two modes, user mode and supervisor mode. For the following segment of a high-level language program, briefly describe what happens during its execution, as far as interrupt, trap and execution mode are concerned. Int i,j; … i = i + 1; WriteToScreen(i); ReadFromKeyboard(j); i = j+1;
Please explain what each one does and why we use it in operating systems 3 public class stringbufferEx lic static void main (String arga[1 stringbufferex stringbutterEestringbutfertx atringaufterix.proceed ) private void proceed ingBuffer stringBuffer new stringBuffer Initial value) System.out.printinistring, format (.8-35s ?s- .with inital value: ,, stringBuffer) r.setLength(o) //Setting the lenght to zero (0), which wil1 also rintin (String.format (-358tAfter setting the lenght to zero clear the contents of the stringBuffer System out stringBuffer.append ("New value") system.out.printin(string.format ("-35s , stringBuffer)) "with...
The case refers to the “classic trap of borrowing short and lending long”. Explain what this means. What are the advantages of borrowing short and lending long? What are the disadvantages?
what's the difference between data memory and instruction memory, and explain what fraction-fraction can use it ?
Page 4 3. Pipeline is an instruction-level parallel processing techni microprocessor systems. The instruction throughput can be dramaticallu increased by this key technique. However, there are so called hazard problems. (a) Branch instruction will introduce problems to a pipelined instruction execution. Explain how this may happen in a DLX machine, and state ONE strategy that can be used to resolve the problem (6 marks) (b) Data hazards occur in instruction execution in a pipelined machine. () What is meant by...