代写代考 COMP 3430 Operating Systems

COMP 3430 Operating Systems
Starting Processes
January 26th, 2022

Copyright By PowCoder代写 加微信 powcoder

By the end of today’s lecture, you should be able to:
▶ Describe how a process is launched by an OS.
▶ (Beginning) Determine what an OS might need to know about a process.
The Rocket Book (Public Domain)

We launched some processes on aviary: ~]> /usr/bin/cat
# start a process using
# the /usr/bin/cat program
Launch! © /DLR (CC BY 2.0)

▶ The book describes the process of launching a process (chapter 4).
▶ … but leaves the implementation as an
▶ Let’s take a look.
Our amazing (and free) textbook. ©RH & AC Arpaci-Dusseau

What is a program?
▶ Let’s take a big step back: What even is a program?
▶ That is, what’s the result of clang -Wall myprog.c -o myprog (do not overthink this…)

▶ A program is literally a file.
▶ A binary, ELF-formatted file (on a Linux
system…)
▶ Let’s take a closer look at an ELF file.
▶ So… a program is a file
▶ HowdoyoureadafileinC?
It’s a file! Pixabay License

Programming Practices January 26th, 2022

By the end of today’s lecture, you should be able to: ▶ Read files in C.

Reading files in C
▶ Start with #include , then: 1. fopen
2. Check the value that was returned. 3. fgets, fgetc, … wait.
Reading! Pixabay License

(Back to 3430)
▶ What kind of data do these functions deal with? ▶ What kind of data is in an ELF formatted file?
▶ Most importantly: Where do these functions come from?

What is an OS?
Linux kernel system call interface ( © CC BY-SA 3.0)

Let’s take a look at how a real OS opens a file.
1. Open one of the Linux kernel links on the
course web page.
2. Can you find where a process is launched?
3. Related to COMP 3350: Is there a
discernible architecture? (3-tier 4 life)
Tux! (CC0 Creative Commons)

Linux: Part 1
Everyone: What system calls do we currently know?

Linux: Part 2
Everyone: Which system call makes the most sense to try find?

Linux: Part 3
Teams: Actually look through the source code.

Starting the process
▶ The OS can read a file.
▶ The OS needs to load the file into
▶ Into a data structure that has
information about the process.
Ready, steady, go! (Pixabay License)

For next time think about this:
What kind of information might an OS need to keep about a process while the process is running ?
Libraries! (Pixabay License)

Quiz (time permitting)
Let’s do a quiz.

▶ An OS first needs to read a program to launch it.
▶ The program is read into a data structure (in memory)
▶ The data structure maintains metadata about the running
▶ The data structure includes an address where the program
starts in memory. ▶ …what’s next?
▶ JMP/JSRR/JSR main
▶ A question for next time: What state is a process in when it

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com