logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

When a user program is executed, it is not safe to let it do anything. How can a user program perform

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

NOTE: YOU CANNOT PUBLICLY RELEASE YOUR SOLUTIONS TO THIS HOMEWORK. It's ok to show your work to your future employer as a private github/gitlab repo, however any public release is prohibited. 

 

# Assignment \#07 - (50 pts)

 

### Questions (10 pts)###

 

**Answer the following** (4 pts)

 

You need to read the chapter 6 "Limited direct execution" of the book OS - Three easy pieces.

 

    1. (2 pts) What does it mean if an OS uses the technique called "direct execution" ( 2 lines max)? The pros are that the implementation is simple, but what are the two downsides?

 

 

    2. (1 pt) When a user program is executed, it is not safe to let it do anything. How can a user program perform (for example) an I/O operation or access the CPU or memory but still being under supervision of the OS? (2 lines max)

 

 

    3. (1 pt) We have seen that the OS needs to regain control regularly and one way to do it is to wait until the running user process makes a system call. But what if a running user process does not make a system call? How would the OS take control back? (2 lines max)

 

 

 

**Answer the following** (6 pts)

 

Below is the sequence of what happens during a system call.

 

|#|Instruction|Mode|Where|Content of r0,r1,r2,r3|

|-|-----------|----|-----|-------|

|1|call C library (p1,p2,p3,p4)|User|pi_shell|r0/r1/r2 parameters depending of S.C.|

|2|lib routine|User|pi_vlibc|r0/r1/r2 no change. r3 set to appropriate syscall number|

|3|callSVC|User|pi_vlibc|same as above|

|4|svc #0|User|pi_utils|same as above|

|5|ldr pc, svc_handlerAddr|Supervisor|boot|same as above|

|6|.word svc|Supervisor|boot|same as above|

|7|svc: bl svc_handler|Supervisor|boot|same as above|

|8|svc_handler|???|pi_syscall|same as above|

 

    1. (1 pt) In what mode does the instructions in the svc_handler execute?

 

 

 

    2. (2 pts) Suppose that, right before the instruction svc #0 the last value stored in the user stack is 0xFFFFFFFF, what would be the last value stored in the user stack after the execution of the instruction? Why? (Be careful when you reply - I want to check if you understand the process...)

 

 

    3. (1 pt) Which instruction actually moves the processor back to user mode? Where is it?

 

 

    4. (1 pt) A program running in user mode can't change the mode bits in the CPSR registers. A  system call will switch from user space to supervisor mode. Can you think of something else that a user program can do that would trigger a switch to supervisor mode?

 

 

    5. (1 pt) Look up a Linux system call that is not read/write/open or close (type man 2 intro) and give a brief explanation of what it does. Please don't do copy/paste...

 

 

### Programming (39 pts)###

 

1. (20 pts) Develop the routines in pi_logging.c as per requirements:

  * logPut (7 pts)

  * logDump (10 pts)

  * logReset (3 pts)

 

 

 

2. (7 pts) Develop the library calls in **pi_vlibc** as per requirements:

  * readStr (2 pts)

  * writeStr (2 pts)

  * panic(1 pt)

  * resetLog (1 pt)

  * dumpLog (1 pt) 

 

3. (12 pts) Develop the system calls in **pi_syscalls** as per requirements:

  * sys_panic (3 pts)

  * sys_read (3 pts)

  * sys_write (3 pts)

  * sys_log (3 pts);

 

Note about programming:

 

    - If your program does not compile, you lose 50% of the corresponding points (and if there is more than 3 compile errors you lose 100%)

    - Your program must be presented professionally (indentation).

    - Your program must be commented appropriately.

    - Your program will be tested with more test cases than the ones you have been given.

 

## Last Question (1 pt) ##

I value your feedback. Please rate this homework:

 

    - How many hours did you spend in total?

    - How much did you learn (0 = nothing to 3 = a lot)?

    - How much did you like it (0 = not at all to 3 = a lot)?

    - Any suggestion?

 

 

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Atharva PatilComputer science

997 Answers

Hire Me
expert
Chrisantus MakokhaComputer science

546 Answers

Hire Me
expert
AyooluwaEducation

771 Answers

Hire Me
expert
RIZWANAMathematics

998 Answers

Hire Me

Get Free Quote!

437 Experts Online