Operating Systems 2017F Lecture 8: Difference between revisions

From Soma-notes
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,..."
 
Akhil (talk | contribs)
mNo edit summary
 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Notes ==
This class was review of older classes and answering questions (No new topics)  
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
User mode: only mode available to us as users.
What is a process: a running program
 
What is a program: set of the instructions, given to the CPU to execute line by line
Kernel: Abstracts hardware so we can use it. eg. we request memory, kernel handles the actual allocation, etc.
Command line/sell/terminal: all same thing
 
 
What is a process: a running program, set of the instructions, given to the CPU to execute line by line
 
Command line/shell/terminal: This is how we can interact with the OS without a desktop environment.
 
How do processes communicate with each other ?
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
They send signals to each other. eg. Child sends a signal to parent when it has finished execution.
 
Orphan process: parent has finished executing and terminated, leaving an "orphaned" child process who's parent process will now be a process from a higher level (grandfather process).


PS: list of process
Zombie process: Process that has finished executing but its entry still exists in the process list. In this case, the parent is still up and running.


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)
File system: managing/organizing the hard drive, control how data is stored/retrieved. Writing and reading from/to a file etc. examples of special files like /proc, etc.


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.
inode is a data structure in linux that is used to store file metadata information like size of file, timestamps, type of file, etc. (however, it does NOT store the name or actual data of the file).  
*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).  
Environment: where we are working.


Environment variable: is where configurations/information about the system/current environment are stored. eg. username, type of terminal being used, prompt, etc.


"echo $USER" in terminal to check the value of "user" environment variable.


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:
Difference between static and dynamic compilation:


Dynamically linked file: loads code as it needs it
Dynamically linked file: loads code from libraries as it needed.
 
Libraries are dynamically loaded into memory versus when they are loaded statically.


Libraries are dynamically loaded into memory versus when they are loaded statically
Statically linked file: loads relevant code into the binary during compilation so no library calls are made during runtime. This is why ltrace gives error.


Man pages are helpful…


Commands:
Commands:
LSPCI: shows you which hardware you are working with  
 
Ps : to find a process ID , coming from the kernel  
lspci: shows you which hardware you are working with
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.  
ps : to find a process ID , coming from the kernel  
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.
ps – aux
 
 
X clock & : generates a clock ?
pstree: displayes the family tree  
How to redirect a file into a text file?
 
ps aux | grep xclock > ps.log
systemd : first one , always wait on the child and checks if the child has to report something to prevent zombie processes.
 
 
*Generate a file on a strace on a program: we should know the command line to do this
Man pages are helpful…
 
"Man man" for more information
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

Latest revision as of 01:21, 9 October 2017

Notes

This class was review of older classes and answering questions (No new topics)


User mode: only mode available to us as users.

Kernel: Abstracts hardware so we can use it. eg. we request memory, kernel handles the actual allocation, etc.


What is a process: a running program, set of the instructions, given to the CPU to execute line by line

Command line/shell/terminal: This is how we can interact with the OS without a desktop environment.

How do processes communicate with each other ? They send signals to each other. eg. Child sends a signal to parent when it has finished execution.

Orphan process: parent has finished executing and terminated, leaving an "orphaned" child process who's parent process will now be a process from a higher level (grandfather process).

Zombie process: Process that has finished executing but its entry still exists in the process list. In this case, the parent is still up and running.


File system: managing/organizing the hard drive, control how data is stored/retrieved. Writing and reading from/to a file etc. examples of special files like /proc, etc.

inode is a data structure in linux that is used to store file metadata information like size of file, timestamps, type of file, etc. (however, it does NOT store the name or actual data of the file).


Environment: where we are working.

Environment variable: is where configurations/information about the system/current environment are stored. eg. username, type of terminal being used, prompt, etc.

"echo $USER" in terminal to check the value of "user" environment variable.


Difference between static and dynamic compilation:

Dynamically linked file: loads code from libraries as it needed.

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

Statically linked file: loads relevant code into the binary during compilation so no library calls are made during runtime. This is why ltrace gives error.


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.

Man pages are helpful… "Man man" for more information