You have a multi-user, multi-core computer with multiple processes currently run
ID: 3579241 • Letter: Y
Question
You have a multi-user, multi-core computer with multiple processes currently running. Your process is going to create a new process that creates a thread to read data from disk then do some processing and then write data out to the disk. Trace the new process from creation through execution to completion, detailing the operations the OS provides. The more detail you include, the more credit you will receive. Include scenarios like “generally it works like this but sometimes X happens and we have to do Y to take care of it.” (An example of this scenario would be an operand fetch from memory, but sometimes the operand is not in memory and a page has to be fetched from disk.)
Sections that should be discussed:
Process How process is created what synchronization might be needed when kernel (system) structures are updated. If this is the rst entry in the structure and structure needs to be allocated (of if the structure is a linked list), where and how does it get allocated? user mode vs kernel mode and how switch is made (assume multiple processes running) threads passing data back and forth, what the OS provides for this operation and how it works How the OS decides which process runs when.
Memory (Your system uses demand paging) steps the OS might go through to execute an instruction including reading from memory where the OS uses demand paging for memory management. include discussion of how the kernel allocates/uses its own memory
Storage What happens when process has to read from or write to the disk? What steps does the OS go through to nd the le on disk? When the disk controller has read in the data, how does it transfer it to the process?
Explanation / Answer
Process:
Kernel Mode :here the executing code has complete and unrestricted access to the underlying hardware. It can execute any CPU instruction and reference to any memory address. Kernel mode is generally reserved for the lowest-level, most trusted functions of the operating system. Crashes in kernel mode are unrecoverable and they will stop all the functions of computer
User Mode: here the executing code has no directly access to hardware or reference memory. Code running in user mode must delegate to system APIs to access hardware or memory. Due to the protection afforded by this sort of isolation, crashes in user mode are always recoverable/non catastrophic. our written code runs in user mode in most of cases.
Memory
concept of demand paging
In Demand paging,when the executing process demands a page,it is brought into memory .here only pages demanded by the process are swapped from secondary storage to main memory.
page tble implementation
to achieve this process a page table implementation is used. The page table maps logical memory to physical memory. The page table uses a bitwise operator to mark if a page is valid or invalid. A valid page is one that currently resides in main memory and an invalid page is one that currently resides in secondary memory and not in primary memory. When a process tries to access a page, the following steps are generally followed:
step 1:Attempt to access page.
step 2:If page is valid in memory then continue processing instruction as normal.
step 3:If page is invalid then a page-fault trap occurs.
step 4:Once page fault occurs,construct to check if the memory reference is a valid reference to a location on secondary memory. If not, the process is terminated .This is called illegal memory access.Otherwise, we have to page in the required page. i.e get the page to main memory
step 5:Schedule disk operation to read the desired page into main memory.
step 6:Restart the instruction that was interrupted by the operating system trap.
storage:
every file has inode number ,which has all the information about the file,except its name and its contents.using this inode number operating systems gets the file's location.once it gets the location ,operating system maintains the file pointer which give access to the file contents for reading and writing.each file will have its own file pointer.
using paging concepts,data is transfered to main memory and here the process looks for the page which it requires.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.