Operating Systems 2017F Lecture 8

From Soma-notes
Revision as of 03:37, 5 October 2017 by Rquaium (talk | contribs) (Created page with "This class was review of older classes and answering questions (No new topics) User mode: only mode available to us Kernel: make a request for memory Kernel: abstracts that,...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This class was review of older classes and answering questions (No new topics) User mode: only mode available to us Kernel: make a request for memory Kernel: abstracts that, it provides you with the RAM you need to access by providing an address What is a process: a running program What is a program: set of the instructions, given to the CPU to execute line by line Command line/sell/terminal: all same thing How do processes communicate with each other ? They send signals to each other. For example, parent knows that child has executed when it receives signal

PS: list of process

Orphan process: parent has finished executing and terminated leaving an "orphaned" child process who parent process will become a process from a higher level

Zombie process: Process that has finished executing but its entry still exists in the process list (parent does not wait for child to terminate before it dies)

Tutorial 2 question : what happens if you removed that line? The program will get stuck and the parent will be waiting if the child is finished. NOT FINISHED THE CHECKING.

  • we don’t necessarily need a system environment
 File system: managing the hard drive, writing and reading to a file etc. 

Environment: where we are working Environment variable: is where configurations are stores, all start with “$” signs. To check resolutions etc. find any info like user etc. Configurations are stored in an environment variable like $USER $PATH stores list of all folders that tells shells where to look for

  • envp[] stores all environment variables

Data structure stores data. Inode is a datastructure on a filesystem in linux that is used to store file information (however, it does NOT store the name or actual data of the file).



File system Device files stored in /dev

Path: List of all folder into which the shell looks at to find a program if not giving it a full path . “looking for the path to find a program we want to run”.

*memory is not continuous 
  • everything is linux is a file ,

Difference between static and dynamic compilation:

Dynamically linked file: loads code as it needs it

Libraries are dynamically loaded into memory versus when they are loaded statically

Man pages are helpful…

Commands: LSPCI: shows you which hardware you are working with Ps : to find a process ID , coming from the kernel Ps – aux Pstree: displayes the family tree . systemd : first one , always wait on the child and checks if the child has to report something to prevent zombie processes. SIGCHILD : how processes communicate , they send signals to communicate with each other and SIGCHILD is one of them A child send it to the parent when it is done its task.   X clock & : generates a clock ? How to redirect a file into a text file?

ps aux | grep xclock > ps.log

 

  • Generate a file on a strace on a program: we should know the command line to do this

  Echo $USER : to identify user name Envp[] : stores all the env variables you have /proc/ 1237 ls /proc/1237$ Send them to raiyan Quaium with a “.” Man man Man readlink : shell command , also a system call Xclock ; is the child of the bash terminal (Do a while loop or a for loop to parse it ) ^ /proc/2363 status? The you get the RAM and all info about the process   Tutorials: Tutorial 1; library calls (not necessary in C code)provided by the operating system or by the C library Printf : system call , apart of the C library Difference between Dynamically and statically compilation? Answer : static don’t make library calls since they already include them, dynamic compilation loads the library into memory then it is refrences. In run time: it has to read an access library then it doesn’t write. <- this is dynamic (Assignment question, dynamic is more efficient according to Google) since the library does not need to be loaded multiple times. Ld : dynamic library Dynamically linked files: Tutorial 2, doing it: To run in the background ls & Bc, 1+1 ; don’t have access to my shell unless I exit this Bc & but its very laggy and you cant quit 3) Ps aux | grep mc 4) zombie process