Skip to content

Conversation

@jackskennel
Copy link
Collaborator

No description provided.


The easiest way thinking about the problem is to develop a system of **direct execution**, where when a process needs to run, the operating system gives full control of the CPU to that process, and the process executes and eventually gives control of the CPU back to the operating system. Under this scheme, the execution of a program on an operating system using a direct execution model would look like this:

*svg goes here*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like there needs to be an svg file here :)


So, whenever a program needs to use a functionality outside of the ones it can directly access, it will make a **syscall**, requesting that the operating system perform some function for it. C programmers may already be familiar syscalls like `read()`, `write()`, `open()`, and `close()`.When a syscall is made, the program gives control of the CPU to the OS and the CPU switches to kernel mode. The OS will then execute the requested instruction, return to user mode, and switch back to the process:

![img](../static/lde/lde-controlflow-diagram.svg)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add diagram to git


The process of an OS choosing to take a process out of its running state is commonly referred to as **preemption**. To enforce preemption, modern CPUs implement a configurable timer that triggers a hardware **interrupt** at regular intervals. This interrupt traps control of the CPU back to the operating system, allowing the operating system to choose whether or not it wants to continue running that process or not:

*gif goes here*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

Copy link
Collaborator

@ramyabygari ramyabygari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lde.md : Overview and Switching CPU modes with syscalls have no images. Gif is not there in preemption
scheduling.md : Image for Fixed priority scheduling is missing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants