Terminology Flashcards

1
Q

What are the access methods for files?

A

•Sequential access

–Information is processed record after record

–Possible operations:

  • Reading the next record/block
  • Adding a record at the end
  • Changing current position pointer
  • Direct access

–Location of a record to be processed is given as the argument of adequate operation

•Indexed access

–Records are identified via special index keys

–Faster access in comparison to the free access

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is CISC?

A

A computer in which individual instructions may perform many operations and take many cycles to execute, in contrast with reduced instruction set computer (RISC).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the requirements of mutual exclusion?

A

•Enforcement

–only one process at a time allowed into its critical section among all processes that have a critical section for the same resource or shared object

  • A process that halts in its non-critical section must not interfere with other processes
  • A process requiring access to a critical section must not be delayed indefinitely

–no deadlock or starvation

  • Access to a process’s critical section must not be delayed when no other process is in a critical section
  • No assumptions are made about relative process speeds or number of processes
  • A process can remains inside its critical section for a finite time only
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is Cache coherence?

A

Cache coherence is the regularity or consistency of data stored in cache memory. Maintaining cache and memory consistency is imperative for multiprocessors or distributed shared memory (DSM) systems. Cache management is structured to ensure that data is not overwritten or lost. Different techniques may be used to maintain cache coherency, including directory based coherence, bus snooping and snarfing. To maintain consistency, a DSM system imitates these techniques and uses a coherency protocol, which is essential to system operations. Cache coherence is also known as cache coherency or cache consistency.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What are the types of scheduling?

A

First-come First-served Scheduling (FCFS)

First-come First-served Scheduling follow first in first out method. As each process becomes ready, it joins the ready queue. When the current running process ceases to execute, the oldest process in the Ready queue is selected for running. That is first entered process among the available processes in the ready queue.The average waiting time for FCFS is often quite long. It is non-preemptive.

Shortest Job First Scheduling (SJF)

This algorithm associates ith each process the length of the next CPU burst.Shortest-job-first scheduling is also called as shortest process next (SPN). The process with the shortest expected processing time is selected for execution, among the available processes in the ready queue. Thus, a short process will jump to the head of the queue over long jobs. If the next CPU bursts of two processes are the same then FCFS scheduling is used to break the tie.SJF scheduling algorithm is probably optimal. It givs the minimum average time for a given set of processes.It cannot be implemented at the level of short term CPU scheduling. There is no way of knowing the shortest CPU burst.SJF can be premptive or non-preemptive.

A premptive SJF algorithm will preempt the currently executing process if the next CPU burst of newly arrived process may be shorter than what is left to the currently executing process.
A Non-premptive SJF algorithm will allow the currently running process to finish.Preemptive SJF Scheduling is sometimes called Shortest Remaining Time First algorithm

**Priority Scheduling**
The SJF is a special case of general priority scheduling algorithm.
A Priority (an integer) is associated with each process.The CPU is allocated to the process with the highest priority.Generally smallest integer is considered as the highest priority.Equal priority processes are scheduled in First Come First serve order.It can be preemptive or Non-preemptive.

Non-preemptive Priority Scheduling
In this type of scheduling the CPU is allocated to the process with the highest priority after completing the present running process.

Preemptive Priority Scheduling
In this type of scheduling the CPU is allocated to the process with the highest priority immediately upon the arrival of the highest priority process. If the equal priority process is in running state, after the completion of the present running process CPU is allocated to this even though one more equal priority process is to arrive.

Highest Response Ratio Next (HRRN) scheduling is a non-preemptive discipline, similar to Shortest Job Next (SJN), in which the priority of each job is dependent on its estimated run time, and also the amount of time it has spent waiting. Jobs gain higher priority the longer they wait which prevents indefinite postponement (process starvation). In fact, the jobs that have spent a long time waiting compete against those which are estimated to have short run times.

Round-Robin Scheduling

This type of scheduling algorithm is basically designed for time sharing system. It is similar to FCFS with preemption added.Round-Robin Scheduling is also called as time-slicing scheduling and it is a preemptive version based on a clock. That is a clock interrupt is generated at periodic intervals usually 10-100ms. When the interrupt occurs, the currently running process is placed in the ready queue and the next ready job is selected on a First-come, First-serve basis. This process is known as time-slicing, because each process is given a slice of time before being preempted.
One of the following happens:

The process may have a CPU urst of less than the time quantum or

CPU burst of currently executing process be longer than the time quantum. In this case the a context switch occurs the process is put at the tail of the ready queue.
In round-robin scheduling, the principal design issue is the length of the time quantum or time-slice to be used. If the quantum is very short, then short processes will move quickly.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are some example systems with monolytic kernels?

A
  • Amoeba
  • MINIX
  • QNX
  • BeOS
  • Haiku
  • Hurd
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is livelock?

A

Livelock is a condition that takes place when two or more programs change their state continuously, with neither program making progress. Processes enter a state of livelock when they clash with each other’s state and fail to progress because both of them are changing the state, hence having the same state at a given time.

Livelock can be best explained with the help of an analogy of two people passing through a passageway and each tries to step around the other, but they end up swaying from side to side, getting in each other’s way as they try to get out of the way. Livelock is different from deadlock in a way that both the processes involved in livelock are repeatedly changing their states with regard to each other and not progressing. Algorithms are produced to get out of the state of livelock by randomly picking a process and stopping its state change.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The system kernel is responsible for managing of computer resources and allowing other processes and programs to run and use these resources. The resource in this case means:

A
  • The CPU - kernel decides at what time (and for how long) the running processes/programs should be allocated to the processor (or porcessors in multiprocessor systems)
  • The memory - kernel decides of which memory each process can use, and determines what to do when not enough memory is available
  • I/O devices - kernel allocates requests from applications to perform I/O to an appropriate device and provides convenient methods for using the device (hides details of the device/access implementation, only convenient interfaces are provided)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is starvation?

A

Starvation is the name given to the indefinite postponement of a process because it requires some resource before it can run, but the resource, though available for allocation, is never allocated to this process. It is sometimes called livelock, though sometimes that name might be reserved for cases where the waiting process is doing something, but nothing useful, as in a spin lock. However it happens, starvation is self-evidently a bad thing; more formally, it’s bad because we don’t want a non-functional system. If starvation is possible in a system, then a process which enters the system can be held up for an arbitrary length of time.

To avoid starvation, it is often said that we want the system’s resources to be shared “fairly”. This is an appealing suggestion, but in practice it isn’t much use because it doesn’t define what we mean by “fairly”, so it’s really more of a description of the problem than a contribution to its solution. It’s more constructive to investigate the paths by which a system can reach a livelocked state, and try to control them.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What are Resources?

A

hardware or software component of the computer system required by the process to operate.

Resources classification:

  • Reusable (memory after process completion, CPU, file handles after process completion, swap space)
  • Consumable (battery power in mobile computers, available free disk space, available free memory)
  • Shared (more than one process may use them in the same time – for example shared memory, pipes)
  • Exclusive (assigned to a selected process, unavailable for others – allocated memory block)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Draw a diagram displaying the responsiblities of logical files

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is Scheduling?

A

The process of deciding how to commit resources between a variety of possible/running tasks (processes). Scheduling is supervised by a special system process called scheduler.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are Access Control Lists (ACL)?

A

a table that tells a computer operating system which access rights each user has to a particular system object, such as a file directory or individual file. Each object has a security attribute that identifies its access control list. The list has an entry for each system user with access privileges. The most common privileges include the ability to read a file (or all the files in a directory), to write to the file or files, and to execute the file (if it is an executable file, or program).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a kernel?

A

a kernel is the central component of most computer operating systems. Its responsibilities include managing the system’s resources (the communication between hardware and software components).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are the different types of directory structures?

A
  • One level structure
  • Two level structure
  • Tree structure
  • A-cyclic graph
  • Generic Graph
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is a Resource Descriptor?

A

storing information about availability of a specified resource. Depending on resource type (file, memory segment, etc.) the descriptor structure may be of various form. The structure is very often forced by the system architecture specification (for example, depending on logical memory structure it may relate to segments, pages, etc.).

The resource descriptor may for example contain information about:

  • Resource ID
  • Resource Type
  • List and number of available resources
  • List (queue) of processes waiting for the resource
  • Allocation procedure
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is RISC?

A

A processor architecture that shifts the analytical process of a computational task from the execution or runtime to the preparation or compile time. By using less hardware or logic, the system can operate at higher speeds. RISC cuts down on the number and complexity of instructions, on the theory that each one can be accessed and executed faster, and that less semiconductor real estate is required to process them. The result is that for any given semiconductor technology, a more powerful microprocessor can be produced with RISC than with complex instruction set computer (CISC) architectures.
This simplification of computer instruction sets gains processing efficiencies. That theme works because all computers and programs execute mostly simple instructions. RISC has five design principles:
• Single-cycle execution — In most traditional central processing unit (CPU) designs, the peak possible execution rate is one instruction per basic machine cycle, and for a given technology, the cycle time has some fixed lower limit. Even on complex CPUs, most compiler-generated instructions are simple. RISC designs emphasize single-cycle execution, even at the expense of synthesizing multi-instruction sequences for some less-frequent operations.
• Hard-wired control, little or no microcode — Microcode adds a layer of interpretive overhead, raising the number of cycles per instruction, so even the simplest instructions can require several cycles.
• Simple instructions, few addressing modes — Complex instructions and addressing modes, which entail microcode or multicycle instructions, are avoided.
• Load and store, register-register design — Only loads and stores access memory; all others perform register-register operations. This tends to follow from the previous three principles.
• Efficient, deep pipelining — To make convenient use of hardware parallelism without the complexities of horizontal microcode, fast CPUs use pipelining. An n-stage pipeline keeps up to “n” instructions active at once, ideally finishing one (and starting another) every cycle. The instruction set must be carefully tuned to support pipelining.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

What is a memory table?

A

A memory table is a set of data which is stored in the computer’s memory.

The advantage of a memory table is it is very fast - you don’t have to read the table from disk.

The disadvantage is the table only exists while the software is running. If the software stops for any reason, or crashes, the memory table is deleted.

There are various strategies for saving data from memory tables to disk, when the contents of the memory table have to be preserved.

In the old days, creating a memory table used to be a big deal - memory was in such short supply, that you had to have a very good reason, to tie up 10s of kilobytes of memory into a memory table.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What types of Interrupts are there?

A

•Program interrupts

–Run-time interrupts

  • Arithmetic overflow,
  • Division by zero,
  • Memory violation (reference outside allowed memory space),

•Hardware interrupts

–Timer,

•Overflow/zero/equal to

–I/O,

•A piece of hardware generates an interrupt wanting to be handled

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is address space?

A

a set (range) of all allowed (valid) memory addresses.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is memory partitioning?

A

•Partition memory into blocks that are allocated to processes

–provide contiguous address spaces

•efficient mapping of logical to physical address

–fixed or static partitions

  • equal-size
  • unequal-size
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

How does address validation works for the conversion of logical address into physical address.

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

What are the three contexts of concurrency?

A

1.Multiple applications

•multiprogramming

–dynamic sharing of processor time between active processes

2.Structured applications

•extension of modular design

–applications programmed as a set of concurrent processes or threads

3.Operating system structure

•modular design

–set of concurrent processes or threads

24
Q

What is deadlock?

A

a deadlock is a situation where two different programs or processes depend on one another for completion, either because both are using the same resources or because of erroneous cues or other problems.

25
Q

What are the benefits of microkernels?

A
  • Small operating system core
  • Contains only essential operating systems functions
  • Many services traditionally included in the operating system are now external subsystems

–device drivers

–file systems

–virtual memory manager

–windowing system

–security services

•Portability

–changes needed to port the system to a new processor is changed in the microkernel

  • not in the other services
  • Distributed system support

–messages are sent without knowing what the target machine is

•Object-oriented operating system

–components are objects with clearly defined interfaces

The microkernel approach consists of defining a simple abstraction over the hardware, with a set of primitives or system calls to implement minimal OS services such as memory management, multitasking, and inter-process communication. Other services, including those normally provided by the kernel such as networking, are implemented in user-space programs, referred to as servers.

Microkernels are easier to maintain than monolithic kernels, but the large number of system calls and context switches might slow down the system because they typically generate more overhead than plain function calls.

26
Q

Explain how the buddy memory algorithm works.

A

The buddy system is a memory allocation and management algorithm that manages memory in power of two increments

There are various forms of the buddy system; those in which each block is subdivided into two smaller blocks are the simplest and most common variety.

Every memory block in this system has an order, where the order is an integer ranging from 0 to a specified upper limit. The size of a block of order n is proportional to 2n, so that the blocks are exactly twice the size of blocks that are one order lower.

Power-of-two block sizes make address computation simple, because all buddies are aligned on memory address boundaries that are powers of two. When a larger block is split, it is divided into two smaller blocks, and each smaller block becomes a unique buddy to the other. A split block can only be merged with its unique buddy block, which then reforms the larger block they were split from.

Starting off, the size of the smallest possible block is determined, i.e. the smallest memory block that can be allocated. If no lower limit existed at all (e.g., bit-sized allocations were possible), there would be a lot of memory and computational overhead for the system to keep track of which parts of the memory are allocated and unallocated. However, a rather low limit may be desirable, so that the average memory waste per allocation (concerning allocations that are, in size, not multiples of the smallest block) is minimized. Typically the lower limit would be small enough to minimize the average wasted space per allocation, but large enough to avoid excessive overhead. The smallest block size is then taken as the size of an order-0 block, so that all higher orders are expressed as power-of-two multiples of this size.

The programmer then has to decide on, or to write code to obtain, the highest possible order that can fit in the remaining available memory space. Since the total available memory in a given computer system may not be a power-of-two multiple of the minimum block size, the largest block size may not span the entire memory of the system.

Consider a system having buddy system with physical address space 128 KB.Calculate the size of partition for 18 KB process.

So, size of partition for 18 KB process = 32 KB. It divides by 2, till possible to get minimum block to fit 18 KB.

27
Q

What is Concurrency?

A

Concurrency is the tendency for things to happen at the same time in a system. Concurrency is a natural phenomenon, of course. In the real world, at any given time, many things are happening simultaneously. When we design software to monitor and control real-world systems, we must deal with this natural concurrency.

When dealing with concurrency issues in software systems, there are generally two aspects that are important: being able to detect and respond to external events occurring in a random order, and ensuring that these events are responded to in some minimum required interval.

If each concurrent activity evolved independently, in a truly parallel fashion, this would be relatively simple: we could simply create separate programs to deal with each activity. The challenges of designing concurrent systems arise mostly because of the interactions which happen between concurrent activities. When concurrent activities interact, some sort of coordination is required.

28
Q

What is Harvard Architecture?

A
  • The name is originated from “Harvard Mark I” a relay based old computer,which stored instruction on punched tape(24 bits wide) and data in electo-mechanical counters.
  • .The computer has two separate memories for storing data and program.
  • Two sets of address/data buses between CPU and memory.
  • Processor can complete an instruction in one cycle if appropriate pipelining strategies are implemented.
  • In the first stage of pipeline the instruction to be executed can be taken from program .In the second stage of pipeline data is taken from the data memory using the decoded instruction or address.
  • Most of the modern computing architectures are based on Harvard architecture.But the number of stages in the pipeline varies from system to system.
  • 2 separate buses one for instructions and one for data
  • When instruction is being fetched from the first one, the other one can provide an argument.
29
Q

What are hybrid kernels?

A

Hybrid kernels are a compromise between the monolithic and microkernel designs. This implies running some services (such as the network stack or the filesystem) in kernel space to reduce the performance overhead of a traditional microkernel, but still running kernel code (such as device drivers) as servers in user space. Basically, these kernels are of structure of microkernel but are implemented
as monolythic

30
Q

Explain how the two file system organisation types work?

A

•Zones (volumens/partitions)

–A logical device is created

–Can refer to a part of one device or many physical devices

–Can contain files and directories

–For each zone a set of metadata is created describing directories and files allocation tables; these metadata is intialised at the file system creation (logial formatting)

•Directories

–A directory is a table that ties filenames with directory entries

–Directories can be of:

  • One level structure (all entries are placed at the same level – all names in the directore have to be unique)
  • Two level structure (directories cannot contain directories)
  • Tree structure (directories can contain directories)
  • A-cyclic graph (one file/directory can be placed in many locations)
  • Generic graph (a cycle is allowed in links between directories)
31
Q

Compare and constrast internal and external memory partitioning.

A

Internal Fragmentation

It somehow relates to fixed size partitioning. The system allocates memory to various programs and processes by dividing them into small blocks as required by the program. However, more memory is allocated sometimes than is needed by the process, which eventually results in excess memory going waste or left unused.

For example, memory can only be allocated to programs in blocks divisible by 4, 8, or 16. When a process requests 24 bytes, it usually gets a block of 32 bytes, the excess 8 bytes is left unused. Thus unused memory resides within a specific allocated location and it is so small that a new process cannot be allocated to it, resulting in waste. This waste is termed as internal fragmentation. Probably the only way to remove this type of fragmentation is by dynamic memory allocation.

External fragmentation

The main memory forms holes between portions of allocated memory that are too small to hold any process. It’s the downside of storage allocation algorithms, when contiguous blocks of unused spaces cannot serve a new request because the spaces are too small for large memory application needs. In simple terms, the non-contiguous blocks create holes in the memory resulting in unused storage that are outside the allocated regions, meaning it cannot be used along with the main memory for larger memory tasks. They end up being isolated and cannot be totally eliminated from the memory space. This is called external fragmentation. It can be removed by compaction which shuffles contents of the memory to place all free memory together.

32
Q

What is a process table?

A

The process table in Linux (such as in nearly every other operating system) is simply a data structure in the RAM of a computer. It holds information about the processes that are currently handled by the OS.

33
Q

What is a nanokernels?

A

A nanokernel (or picokernel) delegates virtually all services — including even the most basic ones like interrupt controllers or the timer — to device drivers to make the kernel memory requirement even smaller than a traditional microkernel.

The term picokernel was sometimes used to further emphasize small size of this kernel.

34
Q

What are attributes of files?

A
  • Name
  • Type
  • Location
  • Size
  • Access rights
  • Access/Modification/Creation time
  • Extended attributes

–ACL (Access Control List)

35
Q

What is context switching?

A

When a process is leaving running state, the processor is available for another process and context switching takes place. This consists of two steps:

  • Saving state (context save) of the process leaving processor,
  • Loading state (context load) of the process to which processor was assigned.
36
Q

What are reasons of process termination?

A
  • Normal completion
  • Time limit exceeded
  • Memory unavailable
  • Memory bounds violation
  • Protection error

–example write to read-only file

  • Arithmetic error
  • Time overrun

–process waited too long for an event

•Manual intervention

–user, administrator

  • I/O failure
  • Invalid instruction

–e.g. processor tries to execute data

•Operating system intervention

–such as when deadlock occurs

  • Parent terminates so child processes terminate
  • Parent kills the child
37
Q

What is a cache hit ratio?

A

a fraction of all memory accesses that are found in cache.

38
Q

What are the different types of process states?

A

•New - is created, but not running

•Running - process program instructions are being
processed

•Waiting - process is waiting for an event (finishing I/O
operation, allocation of new resources,
synchronisation with other processess)

•Ready - process is waiting for processor

•Terminated - process has finished to run and isfreeing
allocated resources

39
Q

What are four control problems within processes and resources?

A

–Mutual Exclusion

•two or more processes require access to a single non-shareable critical resource

–Deadlock

•two or more processes cannot proceed because each is waiting for the other to do something

–Livelock

•is similar to a deadlock, except that the states of the processes involved in the livelock constantly change with regard to one another, but none progressing.

–Starvation

•a process is able to run but never scheduled

40
Q

What is mutual exclusion?

A

A mutual exclusion (mutex) is a program object that prevents simultaneous access to a shared resource. This concept is used in concurrent programming with a critical section, a piece of code in which processes or threads access a shared resource. Only one thread owns the mutex at a time, thus a mutex with a unique name is created when a program starts. When a thread holds a resource, it has to lock the mutex from other threads to prevent concurrent access of the resource. Upon releasing the resource, the thread unlocks the mutex.

41
Q

What are the four types of placement algorithms?

A

•Best-fit algorithm

–chooses the block that is closest in size to the request (process size)

•leaves smallest fragment

–efficient

•but requires searching all the free block list

–slow

  • poor overall performance
  • First-fit algorithm

–use first location into which the process will fit

  • quick
  • processes load in the start of memory

–still has to be searched when trying to find a free block

•Next-fit

–use next location into which the process will fit

  • fastest
  • Worst Fit

–use the largest free block

•leaves largest fragment

42
Q

What is a exokernels?

A

An exokernel is a type of kernel that does not abstract hardware into theoretical models. Instead it allocates physical hardware resources, such as processor time, memory pages, and disk blocks, to different programs.

A program running on an exokernel can link to a library operating system that uses the exokernel to simulate the abstractions of a well-known OS, or it can develop application-specific abstractions for better performance.

43
Q

What is a process?

A

A process is an instance of a program running in a computer. It is close in meaning to task , a term used in some operating systems. In UNIX and some other operating systems, a process is started when a program is initiated (either by a user entering a shell command or by another program). Like a task, a process is a running program with which a particular set of data is associated so that the process can be kept track of. An application that is being shared by multiple users will generally have one process at some stage of execution for each user.

44
Q

What is a Multilevel queue?

A

a scheduling algorithm is used in scenarios where the processes can be classified into groups based on property like process type, CPU time, IO access, memory size, etc. One general classification of the processes is foreground processes and background processes. In a multi-level queue scheduling algorithm, there will be ‘n’ number of queues, where ‘n’ is the number of groups the processes are classified into. Each queue will be assigned a priority and will have its own scheduling algorithm like Round-robin scheduling [1]:194 or FCFS. For the process in a queue to execute, all the queues of priority higher than it should be empty, meaning the process in those high priority queues should have completed its execution. In this scheduling algorithm, once assigned to a queue, the process will not move to any other queues.

45
Q

What is a Process Descriptor?

A

(Process Control Block also called Task Control Block) – is a data in the operating system kernel used by the Process Manager in order to register process state during its monitoring and supervision. It contains usually the following information:

  • The identifier of the process (a process identifier, or PID)
  • Register values for the process including, notably, the Program Counter value for the process
  • The address space for the process
  • Priority (in which higher priority process gets first preference. eg., nice value on Unix /Linux operating systems)
  • Process accounting information, such as when the process was last run, how much CPU time it has accumulated, etc.
  • Pointer to the next PCB i.e. pointer to the PCB of the next process to run
  • I/O Information (i.e. I/O devices allocated to this process, list of opened files, etc).
46
Q

What are the levels of scheduling?

A

Short-Term Scheduler

The short-term scheduler (also known as the CPU scheduler) decides which of the ready, in-memory processes is to be executed (allocated a CPU) after a clock interrupt, an I/O interrupt, an operating system call or another form of signal. Thus the short-term scheduler makes scheduling decisions much more frequently than the long-term or mid-term schedulers – a scheduling decision will at a minimum have to be made after every time slice, and these are very short. This scheduler can be preemptive, implying that it is capable of forcibly removing processes from a CPU when it decides to allocate that CPU to another process, or non-preemptive (also known as “voluntary” or “co-operative”), in which case the scheduler is unable to “force” processes off the CPU.

A preemptive scheduler relies upon a programmable interval timer which invokes an interrupt handler that runs in kernel mode and implements the scheduling function.

Medium-term scheduling

The medium-term scheduler temporarily removes processes from main memory and places them in secondary memory (such as a hard disk drive) or vice versa, which is commonly referred to as “swapping out” or “swapping in” (also incorrectly as “paging out” or “paging in”). The medium-term scheduler may decide to swap out a process which has not been active for some time, or a process which has a low priority, or a process which is page faulting frequently, or a process which is taking up a large amount of memory in order to free up main memory for other processes, swapping the process back in later when more memory is available, or when the process has been unblocked and is no longer waiting for a resource. [Stallings, 396] [Stallings, 370]

In many systems today (those that support mapping virtual address space to secondary storage other than the swap file), the medium-term scheduler may actually perform the role of the long-term scheduler, by treating binaries as “swapped out processes” upon their execution. In this way, when a segment of the binary is required it can be swapped in on demand, or “lazy loaded”. [Stallings, 394]

Long-term scheduling

The long-term scheduler, or admission scheduler, decides which jobs or processes are to be admitted to the ready queue (in main memory); that is, when an attempt is made to execute a program, its admission to the set of currently executing processes is either authorized or delayed by the long-term scheduler. Thus, this scheduler dictates what processes are to run on a system, and the degree of concurrency to be supported at any one time – whether many or few processes are to be executed concurrently, and how the split between I/O-intensive and CPU-intensive processes is to be handled. The long-term scheduler is responsible for controlling the degree of multiprogramming.

In general, most processes can be described as either I/O-bound or CPU-bound. An I/O-bound process is one that spends more of its time doing I/O than it spends doing computations. A CPU-bound process, in contrast, generates I/O requests infrequently, using more of its time doing computations. It is important that a long-term scheduler selects a good process mix of I/O-bound and CPU-bound processes. If all processes are I/O-bound, the ready queue will almost always be empty, and the short-term scheduler will have little to do. On the other hand, if all processes are CPU-bound, the I/O waiting queue will almost always be empty, devices will go unused, and again the system will be unbalanced. The system with the best performance will thus have a combination of CPU-bound and I/O-bound processes. In modern operating systems, this is used to make sure that real-time processes get enough CPU time to finish their tasks.[6]

Long-term scheduling is also important in large-scale systems such as batch processing systems, computer clusters, supercomputers, and render farms. For example, in concurrent systems, coscheduling of interacting processes is often required to prevent them from blocking due to waiting on each other. In these cases, special-purpose job scheduler software is typically used to assist these functions, in addition to any underlying admission scheduling support in the operating system.

47
Q

What is Multilevel Feedback Queue Scheduling (MLFQ)?

A

This Scheduling is like Multilevel Queue(MLQ) Scheduling but in this process can move between the queues. Multilevel Feedback Queue Scheduling (MLFQ) keep analyzing the behavior (time of execution) of processes and according to which it changes its priority.

48
Q

What are the two types of file structures?

A

•Logical structure

–Describes how the information is being organised in the file

–Can be defined at the Operating System or application level

–Usually related to type/function of a file (graphical file, text file, etc.)

•Physical structure

–Describes how the information is being stored in the file

–Is strictly related to the device type where the file is stored

–Can be defined at the Operating System level in the kernel or in the user space

49
Q

Compare and contrast Von Neumann’s and Harvard Architecture?

A

Harvard architecture has separate data and instruction busses, allowing transfers to be performed simultaneously on both busses. A von Neumann architecture has only one bus which is used for both data transfers and instruction fetches, and therefore data transfers and instruction fetches must be scheduled - they can not be performed at the same time.

It is possible to have two separate memory systems for a Harvard architecture. As long as data and instructions can be fed in at the same time, then it doesn’t matter whether it comes from a cache or memory. But there are problems with this. Compilers generally embed data (literal pools) within the code, and it is often also necessary to be able to write to the instruction memory space, for example in the case of self modifying code, or, if an ARM debugger is used, to set software breakpoints in memory. If there are two completely separate, isolated memory systems, this is not possible. There must be some kind of bridge between the memory systems to allow this.

Using a simple, unified memory system together with a Harvard architecture is highly inefficient. Unless it is possible to feed data into both busses at the same time, it might be better to use a von Neumann architecture processor.

Use of caches

At higher clock speeds, caches are useful as the memory speed is proportionally slower. Harvard architectures tend to be targeted at higher performance systems, and so caches are nearly always used in such systems.

Von Neumann architectures usually have a single unified cache, which stores both instructions and data. The proportion of each in the cache is variable, which may be a good thing. It would in principle be possible to have separate instruction and data caches, storing data and instructions separately. This probably would not be very useful as it would only be possible to ever access one cache at a time.

Caches for Harvard architectures are very useful. Such a system would have separate caches for each bus. Trying to use a shared cache on a Harvard architecture would be very inefficient since then only one bus can be fed at a time. Having two caches means it is possible to feed both buses simultaneously….exactly what is necessary for a Harvard architecture.

This also allows to have a very simple unified memory system, using the same address space for both instructions and data. This gets around the problem of literal pools and self modifying code. What it does mean, however, is that when starting with empty caches, it is necessary to fetch instructions and data from the single memory system, at the same time. Obviously, two memory accesses are needed therefore before the core has all the data needed.

This performance will be no better than a von Neumann architecture. However, as the caches fill up, it is much more likely that the instruction or data value has already been cached, and so only one of the two has to be fetched from memory. The other can be supplied directly from the cache with no additional delay. The best performance is achieved when both instructions and data are supplied by the caches, with no need to access external memory at all.

50
Q

What’s the difference between threads and processes?

A

Process

A process is simply a program in execution. For example a WordPad program used being used to edit a document is a process.

There could be multiple processes running in a computer at the same time, for example- Media Player playing a movie, A text editor editing a document etc.

Thread

Whereas a thread is a part of a program that is running concurrently with other parts of the program. For example, when you are using the WordPad program, you can edit a document and can also print another document at the same time.

This is only possible because of multiple threads in execution at the same time in WordPad program, where one thread is looking after editing the document and other thread looking after printing a document.

51
Q

What are reasons for process suspension?

A

•Swapping - the OS needs to release
sufficient main memory to bring
in a process that is ready to execute

•Other OS reason - a process causing system problem
may be suspended; a good reason to
suspend processes is when the
system goes to sleep mode

•User request - a user may wish to suspend a
process for various purposes (for
example for debugging), he may also
send a specified signal to a process
(SIGTSTP signal in POSIX)

•Timing - a process may be executed periodically

•Parent process request - a parent process may suspend a
descendent for synchronisation reasons

52
Q

What is a thread?

A

A thread is the smallest unit of processing that can be performed in an OS. In most modern operating systems, a thread exists within a process - that is, a single process may contain multiple threads.

53
Q

What is an interrupt?

A

What is interrupt?

Interrupt is an interruption of the normal sequence of execution in response to the real-world/real-time events.

Benefits?

Interrupts improve processing efficiency (event-triggered processing ).

How it works?

Currently running process is being suspended because of an event external to that process . The process state has to be stored for resume purposes. Now the interrupt handler is started in order to determine the next operations. Once it finishes it’s job, the suspended process is being resumed.

54
Q

What is memory overlaying?

A

A very important may occur in case of a process is requestion bigger memory fragment than size of system partition (a process is bigger than partition).

In this case usually the operating system provides some specific data structures and special technique called overlaying. Overlaying is spliting of the code (not data!) into some independant parts and replacing one needed part (overlay) with another. The size of an overlay is limited according to memory constraints.

55
Q

Compare and contrast thread and processes?

A

Threads:

  • A thread has no data segment or heap
  • A thread cannot live on its own, it must live within a process
  • There can be more than one thread in a process, the first thread calls main & has the process’s stack
  • Inexpensive creation
  • Inexpensive context switching
  • If a thread dies, its stack is reclaimed

Processes:

  • A process has code/data/heap & other segments
  • There must be at least one thread in a process
  • Threads within a process share code/data/heap, share I/O, but each has its own stack & registers
  • Expensive creation
  • Expensive context switching
  • If a process dies, its resources are reclaimed & all threads die
56
Q

What do all processes include?

A

Each process consists of:

  • Program - defines proces behaviour
  • Data - data being processed and results being returned
  • Resources - create run-time environemnt
  • PCB - Processor Control Block (descriptor) storing / describing current state of the process
57
Q

What are the four types of schedulers?

A
  • Short Term Scheduler (SSch) is responsible for allocation of processor to ready processes
  • Medium Term Scheduler (MSch) is responsible for processes exchange between main and external mamory (i.e. Hard drive)
  • Long Term Scheduler (LSch) – responsible for loading new programs into memory, control of number of tasks in the system as well as balancing resource usage by tasks selection
  • I/O Scheduler – responsible for managing process I/O requests