Installation Process

How to install Ubuntu : The Ubuntu Installation Guide

The Ubuntu installation guide: last updated April 2009

how to install UbuntuWhen it comes to installing Ubuntu, there are so many useful snippets of information on blogs and guides all over the internet. If you Google “How to install Ubuntu”, you’ll see what I mean.

For an Ubuntu beginner or curious Windows intermediate user however, there’s no single, simple source of information when it comes to trying out your first Ubuntu installation. One thing I have noticed is that there’s a lot of technical jargon and sometimes unnecessary terminal commands in lengthy forum posts, but no simple “how to” guides, which I think might put some people off! A shame, when you think about how easy Ubuntu is to install, use and tweak to look really cool!

This post will talk you through your first Ubuntu installation, hopefully teaching you everything you need to know to give Ubuntu a try without breaking or removing your existing Windows installation. The end result will be a “vanilla” Ubuntu Installation running simultaneously with your Windows installation using either the GRUB bootloader, or WUBI, depending on how far you’d like to go on your first Ubuntu experience.

Ubuntu desktop - running Compiz

I hope my guide makes installing Ubuntu an enjoyable, simple experience. By the end of the guide you should have a dual boot Windows / Ubuntu machine that happily plays music, video, and acts as a perfectly usable home office computer with Openoffice 3.0. For the really adventurous you could even run Windows XP inside Virtualbox, which is linked to later on in the guide. The Ubuntu OS is unique and seriously cool, so, enjoy the trip.

The all new Ubuntu login screen

If you’re planning on installing the latest version of Ubuntu (Jaunty Jackalope 9.04) you can install Ubuntu straight from the CD inside Windows or from a USB stick and the install process can takes care of formatting your hard drive partition for you. You might not yet have a spare partition to do this, so I’ve covered shrinking your existing Windows partition to make space for Ubuntu here.

How to install Ubuntu from a CD

1) Download the Ubuntu ISO from http://www.ubuntu.com/getubuntu/download and save to your desktop

2) Burn the ISO image to a blank CD using Roxio CD creator or similar:

burn a disc image with roxio

3) Run the CD from “My Computer” – the CD should ask permission to run at which point you’ll see this option screen:

4) If you’d like to install Ubuntu using Wubi, select “install inside Windows” and follow the instructions. Installing with WUBI is ideal for a first taste of Ubuntu as you can remove from add/remove programs in Windows later on. This install process is really easy but you don’t get the same performance as if Ubuntu had a separate partition running on its EXT3 file system. The following screens are all based on the Wubi installer process, so you can follow the rest of the instructions below.

If you’d like to install Ubuntu separately to Windows, then skip to point 7) below.

Here’s what you see next:

Wubi installer

If you’ve got the space on your hard drive, go for 30gb or more for the installation size.

5) Now configure your installation using the simple settings options. You can specify the location of the Ubuntu installation on your Windows partition, the size of the Ubuntu installation, the Ubuntu flavour (Ubuntu, Kubuntu, Xubuntu, etc), your preferred language, and a username and password for the Ubuntu system.

When you click install, you’ll see this screen:

As soon as the files have finished downloading, you’ll see this:

Time to reboot Wubi installer

6) That’s it! Click reboot now, and select “Ubuntu” on the startup screen. You now have a fully functional dual boot Windows / Ubuntu machine.

If you’d like to install Ubuntu separately to Windows, then follow these instructions:

7) Click “Demo and full installation” and your computer will restart and boot into Ubuntu.

It’s worth saying at this point that you’re about to install Ubuntu on an entirely separate drive partition. That means, you need to make sure you have enough space on your computers hard drive to accomodate the new setup. Keir Thomas found that a partition less than 4gb would lead Ubuntu to crash during install in his first look at Ubuntu 9.04 over at Lifehacker.

Here’s a guide on how to resize or shrink your Windows Vista partition. Follow those instructions before you reboot into the live version of Ubuntu and you’ll have a really easy time during the following steps. Maybe you’d like to install from a USB? Let’s have a quick look at the process of installing from a USB before we continue:

Here’s how to install Ubuntu on a USB drive from Windows Vista:

8) Format your USB stick with a FAT32 partition from Windows. You can get to the format dialogue by opening My Computer and right mouse clicking the removable drive icon. Click “Format” and follow the settings in the image below. You need a minimum 2gb USB stick.

format your USB drive in Windows Vista

9) Download UnetBootin. UNetbootin allows for the installation of various Linux/Ubuntu distributions to a partition or USB drive, so it’s no different from a standard install, only it doesn’t need a CD. The coolest thing about the application is that it’s a “portable” app. You don’t need to install it into Windows meaning UNetbootin will run on your Windows PC without “admin” privileges.

using unetbootin to install the new ubuntu jaunty jackalope

The new version of Ubuntu isn’t in the Distribution list supplied with UNetbootin yet, so use the downloaded Ubuntu ISO from earlier on. Add the ISO using the “Diskimage”, make sure your USB drive is selected below and click OK.

The ISO transfers to the USB pretty quickly, so soon after you click OK you’ll see this screen:

unetbootin complete

10) That’s it – when the installation process is complete, restart your computer and make sure it’s set up to boot from USB. On my HP Laptop, pressing F9 on the boot screen shows a boot order menu. Selecting “USB Hard Drive” follows a black screen, an Ubuntu logo, and finally, your new Ubuntu desktop appears.

Completing your Ubuntu installation, step by step

Installing Ubuntu is so easy that it requires very little effort past this point. If you’ve managed to repartition your hard drive and restart your computer you’ll sail through the next few steps:

11) Click “install” on the live desktop (top left)

vanilla Ubuntu desktop

12) Choose your language in the welcome screen

welcome1

13) Choose your location

Choose location

14) Choose your keyboard layout

welcome31

15) Set up your disk partition. This is probably the most “technical” part of the installation. When I shrunk my Windows Vista drive volume, I never formatted the new partition, which means the “use the largest continuous free space” option works nicely:

Set up a disk partition for Ubuntu

16) Choose your username and password:

Choose your Ubuntu Password

17) Migrate your Windows documents and settings

Migrate your Windows settings

18) You’re now ready to install your new Ubuntu installation

Ready to install

19) When the installation has finished, restart your computer (you’ll be instructed to remove your cd rom or USB drive). You’re now ready to begin using Ubuntu!

Installation Process of open Source OS
Installation Process of Redhat Linux OS

Step 1
The GUI (Graphical User Interface) based installation wizard of Red Hat Linux can be navigated either with the mouse or via the Enter and Tab keys of the keyboard. Launch the installation program via the CD-ROM installer. Make sure that the first boot device defined in the BIOS setup is the CD drive.


Step 2


To verify if the CD drive is the first boot device, press the DEL or F1 key during the boot up process to enter the BIOS setup menu. Make sure to save the changes before exiting. The machine will reboot automatically.

Step 3

Make sure that you have a copy of the driver diskette for your hardware. This is a safety precaution in case some devices are not supported by the installation process. When prompted for the driver, simply insert the driver diskette in the corresponding drive.

Step 4

Upon reboot of the machine, the boot installation program will be displayed. The installation process automatically initiates when no user action is detected within a minute. An alternative is to press the Enter key to boot.

Step 5

The kernel (Linux) will proceed to detect all hardware devices attached to the system. Once all the hardware has been detected correctly, proceed to the next phase. If not, restart the installation procedure by selecting the Expert Mode. This mode eliminates hardware probing allowing the user to manually define and load all the necessary hardware drivers.

Step 6

The installation method will then be asked from the user. Select the CD-ROM option to load the system files from the optical media and choose the OK option.

Step 7

When prompted by the program, place the Red Hat Linux CD into the drive replacing the boot loader.

Step 8

The user will then be asked for the language to be used during the installation process. Using the mouse device, click on the appropriate language from the list and click on the Next button.

Step 9

The screen allows the user to define the keyboard model and layout as well as to enable dead keys. Click the Next button after choosing the correct settings.

Step 10

The mouse is the next device to be configured. The screen provides the user with an option to emulate a 3-button mouse. Choose the Next option when finished configuring the hardware.

Step 11

The Red Hat Linux Welcome Screen will be displayed to the user. Click on the Next button to proceed. Choose the Full Installation option from the succeeding screen and press the Next button.

Step 12

The next screen allows the user to decide on the type of partitioning method to be used. Usually the Automatic partition option is chosen. Click Next to continue.

Step 13

You can now set the Time Zone relative to your location as well as the UTC (Universal Coordinated Time) offset. Click Next to move to the next portion.

Step 14

The next screen is for the Account Configuration. The root password, account name, password, and full name can be declared in this portion. Click the Next button.

Installation Process of Window Vista


Installation Begins

Introduction


After getting the OEM version of Windows Vista in early yesterday, several readers in our forums asked for information on the installation process of the new OS. Never one to disappoint, I took some pictures of the various screens and menus that you'll see if you choose to upgrade to Vista.

The screen shots are mostly self explanatory, but where details are needed I will explain!


A Fresh Installation Begins




-The first screen in our Vista installation process after booting off of the DVD, you can select the installation language and region settings right from the beginning.






-Right away you'll be asked for that all important license key and with the check box below it, you're actually setting an option that will be very important later. When "Auto activate" is checked, Windows Vista will only give you three days to activate; but if you uncheck this box, Vista said I had 30 days to play with the system before activation was required.









-Since this was a blank drive, upgrade options were not allowed, though even if you wanted to upgrade you are forced to start the process from the current Windows OS.









-The actual file copying, expanding and installation is pretty quick; much more so than Windows XP.

-After you set the default user and password, security settings, and time zones you are ready to enter the OS for the first time.








-But not until you let Vista run a performance test on your hardware. This test will generate a performance number for your system which can be used to judge application compatibility with future Vista-ready titles. More on this later.










-The opening screen on Vista is set to answer most of the questions you might have moving from a Window XP experience.








Installation Process















Installation Process of Window XP

1. Insert the Windows Xp CD into your computer and restart your computer.






2. If prompted to start from the CD, press SPACEBAR. If you miss the prompt (it only appears for a few seconds), restart your computer to try again.







3.Windows XP Setup begins. During this portion of setup, your mouse will not work, so you must use the keyboard. On the Welcome to Setup page, press ENTER.












4.On the Windows XP Licensing Agreement page,






read the licensing agreement. Press the PAGE DOWN key to scroll to the bottom of the agreement. Then press F8.












5.This page enables you to select the hard disk drive on which Windows XP will be installed. Once you complete this step, all data on your hard disk drive will be removed and cannot be recovered. It is extremely important that you have a recent backup copy of your files before continuing. When you have a backup copy, press D, and then press L when prompted. This deletes your existing data.

6.Press ENTER to select Unpartitioned space, which appears by default.







7.Press ENTER again to select Format the partition using the NTFS file system, which appears by default.


















8.Windows XP erases your hard disk drive using a process called formatting and then copies the setup files. You can leave your computer and return in 20 to 30 minutes.






Part 2: Continue the installation

9.Windows XP restarts and then continues with the installation process. From this point forward, you can use your mouse. Eventually, the Regional and Language Options page appears. Click Next to accept the default settings. If you are multilingual or prefer a language other than English, you can change language settings after setup is complete.













10.On the Personalize Your Software page, type your name and your organization name. Some programs use this information to automatically fill in your name when required. Then, click Next.












11.On the Your Product Key page, type your product key as it appears on your Windows XP CD case. The product key is unique for every Windows XP installation. Then, click Next.












12.On the Computer Name and Administrator Password page, in the Computer name box, type a name that uniquely identifies your computer in your house, such as FAMILYROOM or TOMS. You cannot use spaces or punctuation. If you connect your computer to a network, you will use this computer name to find shared files and printers. Type a strong password that you can remember in the Administrator password box, and then retype it in the Confirm password box. Write the password down and store it in a secure place. Click Next.












13.On the Date and Time Settings page, set your computer’s clock. Then, click the Time Zone down arrow, and select your time zone. Click Next.












14.Windows XP will spend about a minute configuring your computer. On the Networking Settings page, click Next.







15. On the Workgroup or Computer Domain page, click Next.






Part 3: Complete the installation

16.Windows XP will spend 20 or 30 minutes configuring your computer and will automatically restart when finished. When the Display Settings dialog appears, click OK.












17.When the Monitor Settings dialog box appears, click OK.












18.The final stage of setup begins. On the Welcome to Microsoft Windows page, click Next.












19. On the Help protect your PC page, click Help protect my PC by turning on Automatic Updates now. Then, click Next.







20.Windows XP will then check if you are connected to the Internet:






• If you are connected to the Internet, select the choice that describes your network connection on the Will this computer connect to the Internet directly, or through a network? page. If you’re not sure, accept the default selection, and click Next.







• If you use dial-up Internet access, or if Windows XP cannot connect to the Internet, you can connect to the Internet after setup is complete. On the How will this computer connect to the Internet? page, click Skip.












21. Windows XP Setup displays the Ready to activate Windows? page. If you are connected to the Internet, click Yes, and then click Next. If you are not yet connected to the Internet, click No, click Next, and then skip to step 24. After setup is complete, Windows XP will automatically remind you to activate and register your copy of Windows XP.












22.On the Ready to register with Microsoft? page, click Yes, and then click Next.






23.On the Collecting Registration Information page, complete the form. Then, click Next.





24.On the Who will use this computer? page, type the name of each person who will use the computer. You can use first names only, nicknames, or full names. Then click Next. To add users after setup is complete or to specify a password to keep your account private, read Create and customize user accounts.





25.On the Thank you! page, click Finish.




(0) Resource allocation graph

a set of vertices V and a set of edges E.


  • V is partitioned into to two types:

  1. P= {P1,P2,...,Pn}, the set consisting of all the processes in the system.
  2. R={R1,R2,...,Rm}, the set consisting of all resource types in the system.

-request edge-directed edge P1 [] Rj

-assignment edge-directed edge Rj[]Pi


_Process





_Resource typeb with 4 instances






_Pi requests instance of Rj






_Pi is holding an instance of Rj

Q: How would you know if there's a deadlock based on the Resource Allocation Graph?

Basic Facts:
  • if graph contains no cycle => no deadlock
  • if graph contains a cycle,

---if only one instance per resource type, then deadlock

---if several instances per resource type, possibility of deadlock.


RESOURCE ALLOCATION GRAPH



(0)A Resource Allocation Graph

_This RAG shows a cycle of 3 processes and 4 resource types.






(0) Resource Allocation Graph with deadlock.

-First P1 have a request to R1.The instance of R1 has been hold by P2. This process then sends request to R3 , and P3 is holding its instance. When P3 sends request to R2, which consists of 2 instances. One instance holds by P2 while the other one holds by P1. There exist the deadlock when the instances of two different resource type are been holds by one Process(P2) at the same time.





(0) Resource allocation graph with a cycle but no deadlock

- The graph contains a cycle. Each processes holds an instance of the resource. First, P1 sends request to R1, which contains 2 instances. P2 and P3 are holding these instances . Then, P3 sends request to R2 which also contains 2 instances and each of these are holds by P4 and P1.






(0)Resource allocation graph for deadlock Avoidance

_for deadlock avoidance, it will ensure that a system will never enter an unsafe state. P1 holds the resource type (R1) and P1 then sends request to R2. P2 at the same time sends request to two different resource type.



(0) Unsafe State in a Resource Allocation Graph

_if the system is in unsafe state, there's a possibility of deadlock.



(0) recovery from deadlock
  • Recovery through preemption
take a resource from some other process
– depends on nature of the resource
  • Recovery through rollback
checkpoint a process state periodically
– rollback a process to its checkpoint state if it is found deadlocked
  • Recovery through killing processes
– kill one or more of the processes in the deadlock cycle
– the other processes get its resources In which order should we choose process to kill?
  • Process Termination
  • Abort all deadlocked processes:
    -Fast
    -A lot of process work is lost.
  • Abort one deadlocked process at a time and check for deadlocks again:
    -More work to resolve a deadlock.
    -Better in terms of process work.
    -What is a good order to abort processes?
  • Resource Preemption
    what is a good way to select a victim
    How can we rollback and then recover from preemption?
    How can we protect from starvation

(0) deadlock detection

Often neither deadlock avoidance nor deadlock prevention may be used. Instead deadlock detection and process restart are used by employing an algorithm that tracks resource allocation and process states, and rolls back and restarts one or more of the processes in order to remove the deadlock. Detecting a deadlock that has already occurred is easily possible since the resources that each process has locked and/or currently requested are known to the resource scheduler or OS.

Detecting the possibility of a deadlock before it occurs is much more difficult and is, in fact, generally
undecidable, because the halting problem can be rephrased as a deadlock scenario. However, in specific environments, using specific means of locking resources, deadlock detection may be decidable. In the general case, it is not possible to distinguish between algorithms that are merely waiting for a very unlikely set of circumstances to occur and algorithms that will never finish because of deadlock.

Deadlock detection attempts to find and resolve actual deadlocks. These strategies rely on a Wait-For-Graph (WFG) that in some schemes is explicitly built and analyzed for cycles. In the WFG, the nodes represent processes and the edges represent the blockages or dependencies. Thus, if process A is waiting for a resource held by process B, there is an edge in the WFG from the node for process A to the node for process B.

In the AND model (resource model), a cycle in the graph indicates a deadlock. In the OR model, a cycle may not mean a deadlock since any of a set of requested resources may unblock the process. A knot in the WFG is needed to declare a deadlock. A knot exists when all nodes that can be reached from some node in a directed graph can also reach that node.

In a centralized system, a WFG can be constructed fairly easily. The WFG can be checked for cycles periodically or every time a process is blocked, thus potentially adding a new edge to the WFG. When a cycle is found, a victim is selected and aborted.

(0)Deadlock Prevention

Restrain the ways requests can be made to break one of the four necessary conditions for deadlocks

  • We try to ensure that one of the four necessary conditions cannot hold, then we can prevent it
  • Mutual Exclusion:
    -If it is shareable resource, then we can break the mutual exclusion (such as: Read-only file)
    -If it is not a shareable resource, then mutual exclusion must hold (such as: Printer)
  • Some devices (such as printer) can be spooled

– only the printer daemon uses printer resource

– thus deadlock for printer eliminated

  • Not all devices can be spooled

  • Hold and wait: two methods
    1. Require process to request and be allocated all its resources before it begins execution.
    2. allow process to request resources only when the process has none.

  • NO preemption:

  • If a process that is holding some resources requests
    another resource that cannot be immediately to
    allocated it, then all resources currently being held are
    released.
  • Preempted resources are added to the list of resources
    for which the process is waiting.
    Process will be restarted only when it can regain its old
    resources, as well as the new ones that it is requesting.
  • Attacking the No Preemption Condition:
  • Preemption– when a process is holding some resources and waiting for others, its resources may be preempted to be used by others
  • Problem– Many resources may not allow preemption; i.e., preemption will cause process to fail

  • Attacking the Circular Wait Condition:

  • impose a total order of all resource types; and require that all processes request resources in the same order

(0) Methods for handling deadlock

  • Deadlock Prevention.
    Disallow one of the four necessary conditions for deadlock.
  • Deadlock Avoidance.
    Do not grant a resource request if this allocation have the potential to lead to a deadlock.
  • Deadlock Detection.
    Always grant resource request when possible. Periodically check for deadlocks. If a deadlock exists, recover from it.
  • Ignore the problem...
    Makes sense if the likelihood is very low.
Others:

  1. Ignore the problem and pretend that deadlocks would never occur
  2. Ensure that the system will never enter a deadlock state (prevention or avoidance)
  3. Allow the system to enter a deadlock state and then detect/recover

(0)deadlock characterization

Deadlock can arise if four conditions hold simultaneously:

1.Mutual Exclusion

  • only one process at a time can use a resource.
  • If another process requests that resource, the requesting process must be delayed until the resource has been released


2.Hold and Wait

  • a process that holding at least one resource is waiting to acquire additional resources held by other processes.



3.No Preemption

  • a resource can be released only voluntarily by the process holding it, after that process has completed its task.

4.Circular Wait

  • there exists a set {P0, P1, …, P0} of waiting processes such that
    P0 is waiting for a resource that is held by P1,
    P1is waiting for a resource that is held by P2, …, Pn–1is waiting for a resource that is held by Pn, and P0is waiting for a resource that is held by P0.

(0) thread scheduling

>the thread scheduler, part of the OS (usually) that is responsible for sharing the available CPUs out between the various threads. How exactly the scheduler works depends on the individual platform, but various modern operating systems (notably Windows and Linux) use largely similar techniques that we'll describe here. We'll also mention some key varitions between the platforms.

>Across platforms, thread scheduling1 tends to be based on at least the following criteria:]a priority, or in fact usually multiple "priority" settings that we'll discuss below;]a quantum, or number of allocated timeslices of CPU, which essentially determines the amount of CPU time a thread is allotted before it is forced to yield the CPU to another thread of the same or lower priority (the system will keep track of the remaining quantum at any given time, plus its default quantum, which could depend on thread type and/or system configuration);]a state, notably "runnable" vs "waiting";]metrics about the behaviour of threads, such as recent CPU usage or the time since it last ran (i.e. had a share of CPU), or the fact that it has "just received an event it was waiting for".

(0)Real Time Scheduling

• Many real time systems run a known collection of tasks. The execution time of the tasks is frequently known ahead of time.
• Tasks have deadlines by which they must complete.
• If a task that runs for 3 time units must be done at time 10, it must start by time 7.
• If two tasks that runs for 3 time units each must be done at time 10, one must start by time 4.

(0) Multiprocessor Scheduling

  • Very little has to be done to schedule a multiprocessor system.
  • Whenever a CPU needs a process to run, it takes the next task from the ready list.
  • The scheduling queue must be accessed in a critical section.
  • Busy waiting is usually used.

In computer science, multiprocessor scheduling is an NP-Complete optimization problem. The problem statement is: "Given a set J of jobs where job ji has length li and a number of processors mi, what is the minimum possible time required to schedule all jobs in J on m processors such that none overlap?" The applications of this problem are numerous, but are, as suggested by the name of the problem, most strongly associated with the scheduling of computational tasks in a multiprocessor environment.

Substantial Information about threads of Operating System
  • Windows NT(New Technology) threads

NT's Threads and FibersA thread is Windows NT's smallest kernel-level object of execution. Processes in NT can consist of one or more threads. When a process is created, one thread is generated along with it, called the primary thread. This object is then scheduled on a system wide basis by the kernel to execute on a processor. After the primary thread has started, it can create other threads that share its address space and system resources but have independent contexts, which include execution stacks and thread specific data.


A fiber is NT's smallest user-level object of execution. It executes in the context of a thread and is unknown to the operating system kernel. A thread can consist of one or more fibers as determined by the application programmer.




Figure 2: The relationships of a process and its threads and fibers in Windows NT.

  • Solaris Threads


Light weight process (LWP) is Solaris's smallest kernel-level object of execution. A Solaris process consists of one or more light weight processes. Like NT's thread, each LWP shares its address space and system resources with LWPs of the same process and has its own context. However, unlike NT, Solaris allows programmers to exploit parallelism through a user-level object that is built on light weight processes. In Solaris, a thread is the smallest user-level object of execution. Like Windows NT's fiber, they are not executable alone. A Solaris thread must execute in the context of a light weight process. Unlike NT's fibers, which are controlled by the application programmer, Solaris's threads are implemented and controlled by a system library. The library controls the mapping and scheduling of threads onto LWPs automatically. One or more threads can be mapped to a light weight process. The mapping is determined by the library or the application programmer. Since the threads execute in the context of a light weight process, the operating system kernel is unaware of their existence.



Figure 3: The relationships of a process and its LWPs and threads in Solaris.



  • MacOS threads

    Mac OS 9 Threading

This section describes threading on Mac OS 9. Mac OS 9 has two threading APIs.



  • Thread Manager provides cooperatively scheduled threads within a process.

  • MP tasks are preemptively scheduled by the nanokernel.


In addition to these threading APIs, it's impossible to understand Mac OS 9 threading without also understanding Mac OS 9 process scheduling, as implemented by the Process Manager.


IMPORTANT:Threading terminology can get confusing, especially on a system like Mac OS X that inherits terminology from many different sources. One particularly confusing term is "task." The MP API uses the term "MP task" to describe a thread of execution with a process. On the other hand, Mach uses the term "Mach task" to describe a collection of resources such as threads, memory, and ports (an idea more commonly known as a process). This technote always uses either "MP task" or "Mach task" to differentiate between these two concepts, and never uses the term "task" unqualified.




Figure 1. Mac OS 9 threading.


(0) CPU Scheduling algorothms

CPU scheduling algorithms simulates the scheduling of a CPU, calculate waiting time & average and turnaround time.

This is a Non-Premptive scheduling algorithm. FIFO strategy assigns priority to processes in the order in which they request the processor.The process that requests the CPU first is allocated the CPU first.When a process comes in, add its PCB to the tail of ready queue. When running process terminates, dequeue the process (PCB) at head of ready queue and run it.

Comments: While the FIFO algorithm is easy to implement, it ignores the service time request and all other criteria that may influence the performance with respect to turnaround or waiting time.
Problem: One Process can monopolize CPU
Solution: Limit the amount of time a process can run without a context switch. This time is called a time slice.
  • Round Robin

Round Robin calls for the distribution of the processing time equitably among all processes requesting the processor.Run process for one time slice, then move to back of queue. Each process gets equal share of the CPU. Most systems use some variant of this.

Choosing Time Slice
What happens if the time slice isnt chosen carefully?

  • For example, consider two processes, one doing 1 ms computation followed by 10 ms I/O, the other doing all computation. Suppose we use 20 ms time slice and round-robin scheduling: I/O process runs at 11/21 speed, I/O devices are only utilized 10/21 of time.

  • Suppose we use 1 ms time slice: then compute-bound process gets interrupted 9 times unnecessarily before I/O-bound process is runnable


Problem: Round robin assumes that all processes are equally important; each receives an equal portion of the CPU. This sometimes produces bad results. Consider three processes that start at the same time and each requires three time slices to finish. Using FIFO how long does it take the average job to complete (what is the average response time)? How about using round robin?
Round Robin is fair, but uniformly enefficient.
Solution: Introduce priority based scheduling.


Run highest-priority processes first, use round-robin among processes of equal priority. Re-insert process in run queue behind all processes of greater or equal priority.

  • Allows CPU to be given preferentially to important processes.
  • Scheduler adjusts dispatcher priorities to achieve the desired overall priorities for the processes, e.g. one process gets 90% of the CPU.


Comments: In priority scheduling, processes are allocated to the CPU on the basis of an externally assigned priority. The key to the performance of priority scheduling is in choosing priorities for the processes.
Problem: Priority scheduling may cause low-priority processes to starve
Solution: (AGING) This starvation can be compensated for if the priorities are internally computed. Suppose one parameter in the priority assignment function is the amount of time the process has been waiting. The longer a process waits, the higher its priority becomes. This strategy tends to eliminate the starvation problem.


Maintain the Ready queue in order of increasing job lengths. When a job comes in, insert it in the ready queue based on its length. When current process is done, pick the one at the head of the queue and run it.
This is provably the most optimal in terms of turnaround/response time.
But, how do we find the length of a job?

Comments: SJF is proven optimal only when all jobs are available simultaneously.
Problem: SJF minimizes the average wait time because it services small processes before it services large ones. While it minimizes average wiat time, it may penalize processes with high service time requests. If the ready list is saturated, then processes with large service times tend to be left in the ready list while small processes receive service. In extreme case, where the system has little idle time, processes with large service times will never be served. This total starvation of large processes may be a serious liability of this algorithm.
Solution: Multi-Level Feedback Queques


Several queues arranged in some priority order.
Each queue could have a different scheduling discipline/ time quantum.
Lower quanta for higher priorities generally.


Defined by:

  • # of queues
  • scheduling algo for each queue
  • when to upgrade a priority
  • when to demote

Attacks both efficiency and response time problems.

  • Give newly runnable process a high priority and a very short time slice. If process uses up the time slice without blocking then decrease priority by 1 and double its next time slice.
  • Often implemented by having a separate queue for each priority.
  • How are priorities raised? By 1 if it doesn't use time slice? What happens to a process that does a lot of computation when it starts, then waits for user input? Need to boost priority a lot, quickly.