Definition Of Operating System:
An Operating System can be defined as an interface between user and hardware. It is responsible for the execution of all the processes, Resource Allocation, CPU management, File Management and many other tasks. The purpose of an operating system is to provide an environment in which a user can execute programs in a convenient and efficient manner.
Types of Operating Systems :
- Batch OS – A set of similar jobs are stored in the main memory for execution. A job gets assigned to the CPU, only when the execution of the previous job completes.
- Multiprogramming OS – The main memory consists of jobs waiting for CPU time. The OS selects one of the processes and assigns it to the CPU. Whenever the executing process needs to wait for any other operation (like I/O), the OS selects another process from the job queue and assigns it to the CPU. This way, the CPU is never kept idle and the user gets the flavor of getting multiple tasks done at once.
- Multitasking OS – Multitasking OS combines the benefits of Multiprogramming OS and CPU scheduling to perform quick switches between jobs. The switch is so quick that the user can interact with each program as it runs.
- Time Sharing OS – Time-sharing systems require interaction with the user to instruct the OS to perform various tasks. The OS responds with an output. The instructions are usually given through an input device like the keyboard.
- Real Time OS – Real-Time OS are usually built for dedicated systems to accomplish a specific set of tasks within deadlines.
What is Process in Operating System?
A process is a program under execution. The value of the program counter
(PC) indicates the address of the next instruction of the process being executed.
Each process is represented by a Process Control Block (PCB).
Also Read this Article: Best Tips To Crack Any Interview in 2022
Process Scheduling:
- Arrival Time – Time at which the process arrives in the ready queue.
- Completion Time – Time at which process completes its execution.
- Burst Time – Time required by a process for CPU execution.
- Turn Around Time – Time Difference between completion time and arrival time.
Turn Around Time = Completion Time – Arrival Time - Waiting Time (WT) – Time Difference between turn around time and burst time.
Waiting Time = Turnaround Time – Burst Time
Thread (Important) Definition:
A thread is a lightweight process and forms the basic unit of CPU utilization. A process can perform more than one task at the same time by including multiple threads.
● A thread has its own program counter, register set, and stack
● A thread shares resources with other threads of the same process: the code section, the data section, files and signals.
Important Note :
A new thread, or a child process of a given process, can be introduced by using the fork() system call. A process with n fork() system call generates 2^n – 1 child processes.
There are two types of threads:
● User threads (User threads are implemented by users)
● Kernel threads (Kernel threads are implemented by OS)
Also Read this Article: Digital Marketing Professional Certification Exam Answers [Latest Update!!]
Scheduling Algorithms :
- First Come First Serve (FCFS) : Simplest scheduling algorithm that
schedules according to arrival times of processes. - Shortest Job First (SJF): Processes which have the shortest burst time are
scheduled first. - Shortest Remaining Time First (SRTF): It is a preemptive mode of SJF
algorithm in which jobs are scheduled according to the shortest remaining
time. - Round Robin (RR) Scheduling: Each process is assigned a fixed time, in a
cyclic way. - Priority Based scheduling (Non Preemptive): In this scheduling, processes
are scheduled according to their priorities, i.e., highest priority process is
scheduled first. If priorities of two processes match, then scheduling is
according to the arrival time. - Highest Response Ratio Next (HRRN): In this scheduling, processes with
the highest response ratio are scheduled. This algorithm avoids starvation.
Response Ratio = (Waiting Time + Burst time) / Burst time - Multilevel Queue Scheduling (MLQ): According to the priority of the
process, processes are placed in the different queues. Generally high priority processes are placed in the top level queue. Only after completion of processes from the top level queue, lower level queued processes are
scheduled. - Multilevel Feedback Queue (MLFQ) Scheduling: It allows the process to
move in between queues. The idea is to separate processes according to the characteristics of their CPU bursts. If a process uses too much CPU time, it is moved to a lower-priority queue.
The Critical Section Problem:
- Critical Section – The portion of the code in the program where shared variables are accessed and/or updated.
- Remainder Section – The remaining portion of the program excluding the Critical Section.
- Race around Condition – The final output of the code depends on the order in which the variables are accessed. This is termed as the race around condition.
Also Read out this Article: Top 10 Websites For Job Seekers in 2021
A solution for the critical section problem must satisfy the following three conditions:
- Mutual Exclusion – If a process Pi is executing in its critical section, then no other process is allowed to enter into the critical section.
- Progress – If no process is executing in the critical section, then the decision of a process to enter a critical section cannot be made by any other process that is executing in its remainder section. The selection of the process cannot be postponed indefinitely.
- Bounded Waiting – There exists a bound on the number of times other processes can enter into the critical section after a process has made a request to access the critical section and before the request is granted.
Details About Synchronization Tools:
Semaphore : Semaphore is a protected variable or abstract data type that is
used to lock the resource being used. The value of the semaphore indicates the
status of a common resource.
There are two types of semaphores:
- Binary semaphores (Binary semaphores take only 0 and 1 as value and are used to implement mutual exclusion and synchronize concurrent processes.)
- Counting semaphores (A counting semaphore is an integer variable whose value can range over an unrestricted domain.)
Mutex (A mutex provides mutual exclusion, either producer or consumer can have the key (mutex) and proceed with their work. As long as the buffer is filled by the producer, the consumer needs to wait, and vice versa. At any point of time, only one thread can work with the entire buffer. The concept can be generalized using semaphore.)
Also Read out this Article: All Things You Need To Know About AnyDesk
Deadlocks (Important):
A situation where a set of processes are blocked because each process is holding a resource and waiting for another resource acquired by some other process.
Deadlock can arise if following four conditions hold simultaneously (Necessary Conditions):
- Mutual Exclusion – One or more than one resource is non-sharable (Only one process can use at a time).
- Hold and Wait – A process is holding at least one resource and waiting for
resources. - No Preemption – A resource cannot be taken from a process unless the process releases the resource.
- Circular Wait – A set of processes are waiting for each other in circular form.
Methods for handling deadlock:
There are three ways to handle deadlock:
- Deadlock prevention or avoidance : The idea is to not let the system into a
deadlock state. - Deadlock detection and recovery : Let deadlock occur, then do preemption to handle it once occurred.
- Ignore the problem all together : If deadlock is very rare, then let it happen and reboot the system. This is the approach that both Windows and UNIX take.
Banker’s algorithm is used to avoid deadlock. It is one of the deadlock-avoidance methods. It is named as Banker’s algorithm on the banking system where a bank never allocates available cash in such a manner that it can no longer satisfy the requirements of all of its customers.
Also Read out this Article: Why Should We Use HTTPS Server Instead of Using HTTP Server?
Memory Management:
These techniques allow the memory to be shared among multiple processes.
- Overlays – The memory should contain only those instructions and data that are required at a given time.
- Swapping – In multiprogramming, the instructions that have used the time slice are swapped out from the memory.
Techniques :
(a) Single Partition Allocation Schemes – The memory is divided into two parts. One part is kept to be used by the OS and the other is kept to be used by the users.
(b) Multiple Partition Schemes –
Fixed Partition – The memory is divided into fixed size partitions.
Variable Partition – The memory is divided into variable sized partitions.
Note : Variable partition allocation schemes:
- First Fit – The arriving process is allotted the first hole of memory in which it fits
completely. - Best Fit – The arriving process is allotted the hole of memory in which it fits the best
by leaving the minimum memory empty. - Worst Fit – The arriving process is allotted the hole of memory in which it leaves the
maximum gap.
Note:
● Best fit does not necessarily give the best results for memory allocation.
● The cause of external fragmentation is the condition in Fixed partitioning and
Variable partitioning saying that the entire process should be allocated in a contiguous memory location. Therefore Paging is used.
- Paging – The physical memory is divided into equal sized frames. The main memory is divided into fixed size pages. The size of a physical memory frame is equal to the size of a virtual memory frame.
- Segmentation – Segmentation is implemented to give users a view of memory. The logical address space is a collection of segments. Segmentation can be implemented with or without the use of paging.
Page Fault:
A page fault is a type of interrupt, raised by the hardware when a running program accesses a memory page that is mapped into the virtual address space, but not loaded in physical memory.
Also Read this Article: Shortcut Keys in PC/Computer that Everyone Must Know
Page Replacement Algorithms (Important):
1.First In First Out (FIFO) –
This is the simplest page replacement algorithm. In this algorithm, the operating
system keeps track of all pages in the memory in a queue, the oldest page is in the front of the queue. When a page needs to be replaced, the page in the front of the queue is selected for removal. For example, consider page reference string 1, 3, 0, 3, 5, 6 and 3 page slots. Initially, all slots are empty, so when 1, 3, 0 come they are allocated to the empty slots —> 3 Page Faults. When 3 comes, it is already in memory so —> 0 Page Faults. Then 5 comes, it is not available in memory so it replaces the oldest page slot i.e 1. —> 1 Page Fault. Finally, 6 comes, it is also not available in memory so it replaces the oldest page slot i.e 3 —> 1 Page Fault.
Belady’s anomaly:
Belady’s anomaly proves that it is possible to have more page faults when increasing the number of page frames while using the First in First Out (FIFO) page replacement algorithm. For example, if we consider reference string ( 3 2 1 0 3 2 4 3 2 1 0 4 ) and 3 slots, we get 9 total page faults, but if we
increase slots to 4, we get 10 page faults.
2. Optimal Page replacement –
In this algorithm, pages are replaced which are not used for the longest duration of time in the future.
Let us consider page reference string 7 0 1 2 0 3 0 4 2 3 0 3 2 and 4 page slots.
Initially, all slots are empty, so when 7 0 1 2 are allocated to the empty slots —> 4 Page faults. 0 is already there so —> 0 Page fault. When 3 came it will take the
place of 7 because it is not used for the longest duration of time in the future.–> 1 Page fault. 0 is already there so —> 0 Page fault. 4 will takes place of 1 —> 1 Page Fault. Now for the further page reference string —> 0 Page fault because they are already available in the memory. Optimal page replacement is perfect, but not possible in practice as an operating system cannot know future requests. The use of Optimal Page replacement is to setup a benchmark so that other replacement algorithms can be analyzed against it.
3. Least Recently Used (LRU) –
In this algorithm, the page will be replaced with the one which is least recently used. Let say the page reference string 7 0 1 2 0 3 0 4 2 3 0 3 2 . Initially, we had 4-page slots empty. Initially, all slots are empty, so when 7 0 1 2 are allocated to the empty slots —> 4 Page faults. 0 is already there so —> 0 Page fault. When 3 comes it will take the place of 7 because it is least recently used —> 1 Page fault. 0 is already in memory so —> 0 Page fault. 4 will take place of 1 —> 1 Page Fault. Now for the further page reference string —> 0 Page fault because they are already available in the memory.
Also Read This Article: 10 Killer Google Chrome Tips & Tricks that Everyone Must Know
Disk Scheduling:
Disk scheduling is done by operating systems to schedule I/O
requests arriving for disk. Disk scheduling is also known as I/O scheduling.
- Seek Time: Seek time is the time taken to locate the disk arm to a specified track where the data is to be read or written.
- Rotational Latency: Rotational Latency is the time taken by the desired sector of disk to rotate into a position so that it can access the read/write heads.
- Transfer Time: Transfer time is the time to transfer the data. It depends on the rotating speed of the disk and number of bytes to be transferred.
- Disk Access Time: Seek Time + Rotational Latency + Transfer Time
- Disk Response Time: Response Time is the average of time spent by a request waiting to perform its I/O operation. Average Response time is the response time of all requests.
Disk Scheduling Algorithms (Important):
- FCFS: FCFS is the simplest of all the Disk Scheduling Algorithms. In FCFS, the requests are addressed in the order they arrive in the disk queue.
- SSTF: In SSTF (Shortest Seek Time First), requests having the shortest seek time are executed first. So, the seek time of every request is calculated in advance in a queue and then they are scheduled according to their calculated seek time. As a result, the request near the disk arm will get executed first.
- SCAN: In SCAN algorithm the disk arm moves into a particular direction and services the requests coming in its path and after reaching the end of the disk, it reverses its direction and again services the request arriving in its path. So, this algorithm works like an elevator and hence is also known as elevator algorithm.
- CSCAN: In SCAN algorithm, the disk arm again scans the path that has been scanned, after reversing its direction. So, it may be possible that too many requests are waiting at the other end or there may be zero or few requests pending at the scanned area.
- LOOK: It is similar to the SCAN disk scheduling algorithm except for the difference that the disk arm in spite of going to the end of the disk goes only to the last request to be serviced in front of the head and then reverses its direction from there only. Thus it prevents the extra delay which occurred due to unnecessary traversal to the end of the disk.
- CLOOK: As LOOK is similar to SCAN algorithm, CLOOK is similar to CSCAN disk scheduling algorithm. In CLOOK, the disk arm in spite of going to the end goes only to the last request to be serviced in front of the head and then from there goes to the other end’s last request. Thus, it also prevents the extra delay which occurred due to unnecessary traversal to the end of the disk.
Also Read This Article: What are the Subfields in Computer Science Engineering?
Key Terms
● Real-time system is used in the case when rigid-time requirements have been
placed on the operation of a processor. It contains well defined and fixed time
constraints.
● A monolithic kernel is a kernel which includes all operating system code in a
single executable image.
● Micro kernel: Microkernel is the kernel which runs minimal performance
affecting services for the operating system. In the microkernel operating system
all other operations are performed by the processor.
Macro Kernel: Macro Kernel is a combination of micro and monolithic kernel.
● Re-Entrancy : It is a very useful memory saving technique that is used for
multi-programmed time sharing systems. It provides functionality that multiple
users can share a single copy of a program during the same period. It has two
key aspects:
The program code cannot modify itself and the local data for each
user process must be stored separately.
● Demand paging specifies that if an area of memory is not currently being used,
it is swapped to disk to make room for an application’s need.
● Virtual memory (Imp) is a very useful memory management technique which
enables processes to execute outside of memory. This technique is especially
used when an executing program cannot fit in the physical memory.
● RAID stands for Redundant Array of Independent Disks. It is used to store the
same data redundantly to improve the overall performance. There are 7 RAID
levels.
● Logical address space specifies the address that is generated by the CPU. On
the other hand, physical address space specifies the address that is seen by
the memory unit.
Fragmentation is a phenomenon of memory wastage. It reduces the capacity
and performance because space is used inefficiently.
- Internal fragmentation: It occurs when we deal with the systems that
have fixed size allocation units. - External fragmentation: It occurs when we deal with systems that have
variable-size allocation units.
● Spooling is a process in which data is temporarily gathered to be used and
executed by a device, program or the system. It is associated with printing. When different applications send output to the printer at the same time, spooling keeps these all jobs into a disk file and queues them accordingly to the printer.
● Starvation is Resource management problem. In this problem, a waiting process does not get the resources it needs for a long time because the resources are
being allocated to other processes.
● Aging is a technique used to avoid starvation in the resource scheduling system.
Advantages of multithreaded programming:
- Enhance the responsiveness to the users.
- Resource sharing within the process.
- Economical
- Completely utilize the multiprocessing architecture.
Thrashing is a phenomenon in virtual memory schemes when the processor
spends most of its time in swapping pages, rather than executing instructions.
Latest Post :
- Top 100 Java Programming Multiple Choice Questions For Beginners | OOPs MCQ {2022}
- Keyboard Shortcuts For VS Code | VS Code Shortcut Keys Cheatsheet 2022
- 100+ Shortcut Keys For MS Excel | Keyboard Shortcut in Excel
- Most Important ReactJs Interview Questions in 2022
- Most Important JavaScript Questions & Answers in 2022
Also Checkout Other Articles:
Checkout Linkedin Assessment Answers – All LinkedIn Skill Assessment Answers | 100% Correct Answers | Free Quiz With LinkedIn Badge
Checkout Cognitive Classes Quiz Answers – All Cognitive Classes Answers | Free Course With Certificate | Free Cognitive Class Certification 2021
Checkout IBM Data Science Professional Certificate Answers – IBM Data Science Professional Certificate All Courses Answers | Free Data Science Certification 2021
Checkout Semrush Course Quiz Answers – Free Quiz With Certificate | All Semrush Answers For Free | 100% Correct Answers
Checkout Google Course Answers – All Google Quiz Answers | 100% Correct Answers | Free Google Certification
Checkout Hackerrank SQL Programming Solutions –Hackerrank SQL Programming Solutions | All SQL Programming Solutions in Single Post
Checkout Hackerrank Python Programming Solutions – Hackerrank Python Programming Solutions | All Python Programming Solutions in Single Post
Checkout Hackerrank Java Programming Solutions – Hackerrank JAVA Programming Solutions | All JAVA Programming Solutions in Single Post
Checkout Hackerrank C++ Programming Solutions – Hackerrank C++ Programming Solutions | All C++ Programming Solutions in Single Post
Checkout Hackerrank C Programming Solutions Certification Answers –Hackerrank C Programming Solutions | All C Programming Solutions in Single Post
Merely wanna comment on few general things, The website pattern is perfect, the subject matter is real great : D.
amei este site. Para saber mais detalhes acesse nosso site e descubra mais. Todas as informações contidas são informações relevantes e diferentes. Tudo que você precisa saber está ta lá.
I like looking through and I believe this website got some truly useful stuff on it! .
Thanks a lot for giving everyone an extraordinarily breathtaking possiblity to read from this site. It can be so ideal and full of amusement for me and my office colleagues to search your web site the equivalent of thrice a week to see the new stuff you will have. Not to mention, I’m so certainly astounded with your brilliant tips and hints you give. Certain 4 tips in this post are completely the best we have all ever had.
Hi! Do you use Twitter? I’d like to follow you if that would be ok. I’m undoubtedly enjoying your blog and look forward to new posts.
I will right away snatch your rss feed as I can not find your e-mail subscription link or newsletter service. Do you’ve any? Please allow me recognize so that I may just subscribe. Thanks.
Do you mind if I quote a couple of your articles as long asI provide credit and sources back to your website?My blog site is in the very same niche as yours and my users would certainly benefit from some of the information you present here.Please let me know if this okay with you. Thanks!
Regards for all your efforts that you have put in this. very interesting info .
Hmm it seems like your website ate my first comment (it was super long) so I guess I’ll just sum it up what I had written and say, I’m thoroughly enjoying your blog. I as well am an aspiring blog blogger but I’m still new to everything. Do you have any suggestions for novice blog writers? I’d certainly appreciate it.
You really make it seem so easy with your presentation but I find this matter to be actually something which I think I would never understand. It seems too complex and very broad for me. I am looking forward for your next post, I’ll try to get the hang of it!
I’d have to examine with you here. Which is not one thing I usually do! I take pleasure in reading a post that may make folks think. Additionally, thanks for permitting me to comment!
Thanx for the effort, keep up the good work Great work, I am going to start a small Blog Engine course work using your site I hope you enjoy blogging with the popular BlogEngine.net.Thethoughts you express are really awesome. Hope you will right some more posts.
Hi! This post couldn’t be written any better! Reading through this post reminds me of my good old room mate! He always kept chatting about this. I will forward this article to him. Fairly certain he will have a good read. Thanks for sharing!
I am no longer certain the place you are getting your info, but good topic. I must spend some time studying more or figuring out more. Thanks for great info I used to be searching for this information for my mission.
Appreciating the dedication you put into your website and in depth information you offer. It’s nice to come across a blog every once in a while that isn’t the same out of date rehashed material. Fantastic read! I’ve saved your site and I’m adding your RSS feeds to my Google account.
Hello. impressive job. I did not expect this. This is a excellent story. Thanks!
Good site! I really love how it is simple on my eyes and the data are well written. I am wondering how I could be notified whenever a new post has been made. I have subscribed to your feed which must do the trick! Have a great day!
I savor, cause I found exactly what I used to be looking for. You’ve ended my 4 day lengthy hunt! God Bless you man. Have a nice day. Bye
Thanks for one’s marvelous posting! I definitely enjoyed reading it, you’re a great author.I will make certain to bookmark your blog and will eventually come back down the road. I want to encourage you to definitely continue your great job, have a nice afternoon!
I’m always impressed by the level of triumph and dedication shown in your blog posts. Your team’s loyalty to providing critical content is really remarkable. save going on the good work!
I’m always impressed by the level of feat and dedication shown in your blog posts. Your team’s commitment to providing necessary content is in point of fact remarkable. save happening the good work!
I’m always impressed by the level of exploit and dedication shown in your blog posts. Your team’s commitment to providing necessary content is essentially remarkable. keep going on the great work!
I gotta favorite this website it seems handy extremely helpful
Fantastic blog you have here but I was curious if you knew of any forums that cover the same topics talked about in this article? I’d really like to be a part of online community where I can get advice from other experienced people that share the same interest. If you have any suggestions, please let me know. Thanks!
Thanks for the auspicious writeup. It in truth was once a enjoyment account it. Look advanced to more brought agreeable from you! However, how can we keep in touch?
buy generic tadalafil 10mg tadalafil 20mg tablet top erection pills
I got what you mean , thankyou for posting.Woh I am delighted to find this website through google.
I appreciate your work, thankyou for all the good posts.
I am continuously invstigating online for tips that can aid me. Thank you!
duricef 500mg sale order duricef sale finasteride 5mg pill
buy estradiol 1mg online how to buy estrace prazosin 2mg sale
purchase fluconazole generic buy ciprofloxacin paypal order cipro 500mg pill
flagyl 400mg ca keflex uk buy keflex 500mg online
cleocin where to buy erythromycin 250mg over the counter buy generic sildenafil 100mg
order indocin online cheap how to buy suprax suprax 200mg oral
nolvadex 10mg cost buy ceftin 500mg online buy ceftin 250mg online
amoxicillin uk buy clarithromycin 250mg online cheap biaxin canada
clonidine 0.1mg sale cheap antivert 25 mg buy spiriva 9mcg without prescription
purchase sildenafil order suhagra 50mg generic sildenafil pills 25mg
buy generic leflunomide for sale order viagra generic purchase sulfasalazine pills
buy accutane for sale order azithromycin online zithromax 250mg ca
goodrx cialis tadalafil 5mg us cheap tadalafil for sale
azipro pill buy azipro cheap buy neurontin 800mg pills
ivermectin 6mg otc order stromectol 6mg online order deltasone 5mg generic
vardenafil oral purchase levitra online plaquenil pills
You really make it seem so easy with your presentation but I find this matter to be actually something that I think I would never understand. It seems too complicated and extremely broad for me. I’m looking forward for your next post, I’ll try to get the hang of it!
ramipril price glimepiride oral etoricoxib online
vardenafil uk generic vardenafil 20mg buy generic hydroxychloroquine
order mesalamine 800mg without prescription buy generic mesalamine buy avapro 300mg online cheap
buy olmesartan for sale buy olmesartan 10mg without prescription divalproex order online
buy generic carvedilol oral chloroquine aralen 250mg without prescription
I like your writing style genuinely loving this site.
Hey there! Do you know if they make any plugins to assist with SEO? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good results. If you know of any please share. Thanks!
digoxin 250mg ca order molnunat 200 mg generic purchase molnupiravir without prescription
naprosyn 500mg ca naproxen 250mg pill order prevacid 15mg without prescription