Final
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
all:
|
||||
gcc hw.c -o hw
|
||||
@@ -0,0 +1,19 @@
|
||||
# COS331-HW1-PEASE
|
||||
|
||||
## Overview
|
||||
This repository contains the code and documentation for Homework 1 of COS331.
|
||||
|
||||
## Installation / Usage
|
||||
1. Clone the repository:
|
||||
```
|
||||
git clone https://github.com/yourusername/COS331-HW1-PEASE.git
|
||||
```
|
||||
2. Navigate to the project directory:
|
||||
```
|
||||
cd COS331-HW1-PEASE
|
||||
```
|
||||
3. Build and run
|
||||
```
|
||||
make
|
||||
./hw
|
||||
```
|
||||
@@ -1,32 +0,0 @@
|
||||
HW1
|
||||
COS331
|
||||
NICHOLAS PEASE
|
||||
18 FEB 2025
|
||||
-----------------------------------------------
|
||||
1) The system call table stores the addresses of the memory in which the system call code lives. When a system call is executed, it is looked up against this table, its address copied into PC, and execution transfered
|
||||
2) System calls are provided to allow programmers a simplier method of accessing key operating system functions
|
||||
3) A trap instruction is used to cause a software interrupt. This is useful for switching the execution mode between user and kernal
|
||||
4) A divide by zero error is non maskable as there is no way to continue with the operatuib since the hardware cannot handle it
|
||||
5) The last register stored in a context switch is the PC register as it holds the return address to return to
|
||||
6) In a single CPU system, the Os is idling as the user process executes as it has the processor for that duration of time.
|
||||
7) The process remains in memory stagnant while it is not executing. The instructions are unloaded from the CPU, but the source of those instructions remains for whenever the process is picked back up, or terminated. This structure is a Process Control Block (PCB)
|
||||
8) The operating system, via system calls and other mechanisms, places limitations on the memory and what a particular program is able to access. Without these limitations, nothing would ensure that a process stays within its own space.
|
||||
9) 5 major activities of an operating system regarding process management are process creation, termination, scheduling, synchronization, communication and management
|
||||
10) 3 major activities of an OS regarding memory management are memory allocation, swapping and paging
|
||||
11) a, b, d
|
||||
12)
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
int ret = fork();
|
||||
if (ret) {
|
||||
printf("I am the parent\n");
|
||||
} else {
|
||||
printf("I am the child\n");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user