Operating Systems 2017F Lecture 19: Difference between revisions

From Soma-notes
KYuan (talk | contribs)
No edit summary
Line 9: Line 9:


Where's main?
Where's main?
* lots of program shave "main" functions - a function that runs first and controls the execution of the program
* lots of program shave "main" functions - a function that runs first and controls the execution of the program<br>
* Do these have "main" functions?
* Do these have "main" functions?<br>
** Linux kernel modules
** Linux kernel modules<br>
** FUSE applications?
** FUSE applications?<br>
** the linux kernel?
** the linux kernel?<br>
** node web applications?
** node web applications?<br>




Line 68: Line 68:




OS kernels are essentially the same thing
OS kernels are essentially the same thing<br>
 
 
what is the flow of control ? what connection between things we are doing in the new terminal and the old one<br>
 
-> these programs are communicating to each other, it will be invoked when we use mnt (mount) the kernel knows it is a filesystem , process runs system calls, then kernel talks to out original terminal. How? you can use strace to know, it is waiting to be invoked, to receive and responds to messages. events will be passed off to another process. switching between one process to another. it has potential security benefits. <br>
 
Key to understand this tutorial : <br>
 
-> understand net flow control. <br>
 
-> how do processes communicate?<br>
 
-> how does it take a directory int and creates a filesystem from it?: <br>
 
***sub tree starting at mount is delegated to this process.<br>
***permissions are limited <br>
 
How to kill it?<br>
 
-> ctrl c , no , you can but the kernel will be unhappy.<br>
-> unmount the file system when you are done using it <br>
-> umount / you have to do it as root <br>
 
 
 
 
*No class Thursday! no office hours on Wednesday

Revision as of 19:14, 21 November 2017

[Notes]

Sample sample


Additional Notes

Where's main?

  • lots of program shave "main" functions - a function that runs first and controls the execution of the program
  • Do these have "main" functions?
    • Linux kernel modules
    • FUSE applications?
    • the linux kernel?
    • node web applications?


In many systems, "main" just sets up even handlers

  • the event loop can be implicit or explicit
    • or there may be no loop at all, just handlers and "interrupts" some kind
  • event loops poll (check) to see when there are new events
  • what are event loops for node app?
    • where are interrupts for node apps?
      • Incoming network requests, it's an event

Code run differently in the kernel :

1)functions runs on the bhealf of insmod, unles sit is Independence context

2)codes that run on the bhelaf o the process


3)after an interrupt: no process , it is an interrupt cotext

4) file names : regular programs but the square brackets, execution context + address space. they share the kernel's address space, they are called kernel threads which are independently scheduling . You can not kill them but you can change their scheduling , maybe their priority but not 100%.

does it create a proces? no , but it can create a kernel thread (is it a process? virtual adress space, .
multi- threaded: maintains multiple address processes , ex: fire fox.

ps -elF | less "number" : displays threads.

top : displays all the processes

ls time : shows you the time .

sys: how much time in the kernel space real: how much time user : how much time in user space

process : can't manipulate its own memory map directly, it has an address space, but cant change it. Process: is limited but the kernel is not and the kernel can change it's own address and in charge of its self.

Kernel tasks : are threads, when a process makes a system call , thi sis schedules in the process priority.



When running
"time ls"
real = realtime it took to run user = the user space time sys = kernel time


What's flow of control in tutorial 7?
What is the connection?
To exit the program, we must unmount the filesystem, run "sudo umount mnt"


OS kernels are essentially the same thing


what is the flow of control ? what connection between things we are doing in the new terminal and the old one

-> these programs are communicating to each other, it will be invoked when we use mnt (mount) the kernel knows it is a filesystem , process runs system calls, then kernel talks to out original terminal. How? you can use strace to know, it is waiting to be invoked, to receive and responds to messages. events will be passed off to another process. switching between one process to another. it has potential security benefits.

Key to understand this tutorial :

-> understand net flow control.

-> how do processes communicate?

-> how does it take a directory int and creates a filesystem from it?:

      • sub tree starting at mount is delegated to this process.
      • permissions are limited

How to kill it?

-> ctrl c , no , you can but the kernel will be unhappy.
-> unmount the file system when you are done using it
-> umount / you have to do it as root



  • No class Thursday! no office hours on Wednesday