CYSE 211 midterm practice

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

20. The scheduling in which CPU is allocated to the process with least CPU-burst time is called (a) Priority Scheduling (b) Shortest job first Scheduling (c) Round Robin Scheduling (d) Multilevel Queue Scheduling

(b) Shortest job first Scheduling

Q. A virtual memory system has a page size of 1024 words, eight virtual pages, and four physical page frames. The page table is as follows: Virtual page Number Page Frame Number 0 1 1 0 2 3 3 - 4 - 5 2 6 - 7 - c. What are the physical addresses corresponding to the following decimal virtual addresses: 0, 3728, 1023, 1024, 1025, 7800, 4096?

0 = 1024 3728 = page fault 1023 = 2047 1025 = 1 7800 = page fault 4096 = 3072

Q. A virtual memory system has a page size of 1024 words, eight virtual pages, and four physical page frames. The page table is as follows: Virtual page Number Page Frame Number 0 1 1 0 2 3 3 - 4 - 5 2 6 - 7 - b. What is the size of the physical address space? (How many bits in a physical address?)

12 bits

Q. A virtual memory system has a page size of 1024 words, eight virtual pages, and four physical page frames. The page table is as follows: Virtual page Number Page Frame Number 0 1 1 0 2 3 3 - 4 - 5 2 6 - 7 - a. What is the size of the virtual address space? (How many bits in a virtual address?)

13 bits

An I/O bound program will typically have: A) a few very short CPU bursts B) many very short I/O bursts C) many very short CPU bursts D) a few very short I/O burts

A) a few very short CPU bursts

The page table contains: A) base address of each page in physical memory B) page offset C) page size D) none of the mentioned

A) base address of each page in physical memory

CPU switching from one process to another requires saving the state of the current process and loading the latest state of the next process, is known as _____ A) context switch B) packet switch C) process switch D) processor switch

A) context switch

When the memory allocated to a process is slightly larger than the process, then: A) internal fragmentation occurs B) external fragmentation occurs C) both a and b D) neither a nor b

A) internal frag occurs

An optimal page replacement algorithm produces the ____ rate of all algorithm a) lowest page fault B) highest page fault C) both a and b D) fragmentation

A) lowest page fault

Swap space exists in A) primary memory B) secondary memory C) CPU

A) secondary memory space on a hard disk used as the virtual memory extension of a computer's real memory (RAM)

A FIFO replacement algorithim associates with each page the A)time it was brought in memory B) size of the page in memory C) page after and before it D) all of these

A) time it was brought in memory

Q) Let's say a program has 1010 bytes and will be loaded into page frames of 256 bytes each, (assuming the job begins loading at the first page (Page 0) in memory), and the instruction to be used is at Byte 577, answer the following questions: a. How many pages are needed to store the entire job?

ANS: 4 pages -- Assuming the job begins loading at the first page (Page 0) in memory then the pages would be Page 0, Page 1, Page 2, and most of Page 3. This is calculated thusly: 1010/256 = 3.94.

Virtual Memory

All the pages of a process are maintained on disk. When a process is executing, some of its pages are in main memory. If reference is made to a page that is not in main memory, the memory management hardware detects this and arranges for the missing page to be loaded. Such a scheme is referred to as virtual memory

Q) Using SJN, calculate the start time and finish time for each of these seven jobs that arrive one CPU cycle apart. Then indicate the order in which the jobs run to completion. It might help to draw a timeline to understand when jobs arrive and finish. Job Arrival Time CPU Cycle A 0 4 B 1 11 C 2 4 D 4 1 E 5 9 F 7 4 G 8 2

Answers: When Job A starts (Time 0), it is the only Job in ready for processing. When Job D is ready to start (Time 4), Jobs B, C, and D are ready for processing and Job D is the shortest job waiting. When Job D finishes (Time 5), Jobs B, C, E are ready for processing and Job C is the shortest job waiting. When Job C finishes (Time 9), all of the other jobs are ready for processing and Job G is the shortest job waiting. Thereafter, the remaining jobs finished in turn. Job Order Start Time CPU Cycle Finish Time A 0 4 4 D 4 1 5 C 5 4 9 G 9 2 11 F 11 4 15 E 15 9 24 B 24 11 35

which of the following is not the state of a process A) new B) old C) ready D) running

B) old

When a process begins execution with no pages in memory A) process execution becomes impossible B) a page fault occurs for every page brought in memory C) process causes system crash

B) page fault

Memory management technique in which system stores and retrieves data from secondary storage for use in main memory is called A) fragmentation B) paging C) mapping D) none of the mentioned

B) paging

Round robin scheduling falls under the category of A) non preemptive scheduling B) preemptive scheduling C) none of these

B) preemptive

The number of processes completed per unit time is known as A) output B) throughput C) efficiency D) capacity

B) throughput

Briefly explain a buffer overflow and list 3 countermeasures

Buffer overflow is defined as the condition in which a program attempts to write data beyond the boundaries of pre-allocated fixed length buffers. This vulnerability can be used by a malicious user to alter the flow control of the program, leading to the execution of malicious code. countermeasures: Address Space Randomization, The StackGuard Protection Scheme, Non-Executable Stack, Configuring /bin/sh

In segmentation, each address is specified by: A) a segment number B) an offset C) a and b D) a key

C) a and b

What is compaction? A) technique for overcoming internal fragmentation B) paging technique C) technique for overcoming external fragmentation D) technique for overcoming fatal error

C) technique for overcoming external fragmentation

Which one of the following is the address generated by CPU A) physical address B) absolute address C) virtual address D) none of the mentioned

C) virtual address

Offset

Distance from beginning of page to end of page frame

Relocation register

Hardware element that tracks how much a job has moved in the main memory after compaction, it's used to track each instruction so it can be found successfully after job's relocation

What is the page frame #?

Physical page location in main memory

2. ____ scheduling is approximated by predicting the next CPU burst with an exponential average of the measured lengths of previous CPU bursts. Multilevel queue RR FCFS SJF

SJF

Q) Explain why, or why not, internal fragmentation can be a problem when using the best fit algorithm for memory allocation.

The requested space could be less than the smallest suitable available partition. If using fixed partitions, internal fragmentation will result. If using dynamic partitions, external fragmentation will result. If using pages, best fit may not be appropriate. Best fit with fixed partitions tends to reduce the unused space, while for dynamic partitions it tends to produce very small unallocatable regions.

5. What is a long-term scheduler ? a) It selects which process has to be brought into the ready queue b) It selects which process has to be executed next and allocates CPU c) It selects which process to remove from memory by swapping d) None of these

a) It selects which process has to be brought into the ready queue

15. A solution to the problem of external fragmentation is : a) compaction b) larger memory space c) smaller memory space d) None of these

a) compaction

12. Virtual memory allows : a) execution of a process that may not be completely in memory b) a program to be larger than the physical memory c) a program to be larger than the secondary storage d) execution of a process without being in physical memory

a) execution of a process that may not be completely in memory b) a program to be larger than the physical memory

16. A situation where the total size of hole is divided into a set of smaller holes is large enough to hold another process for execution but the process cannot be loaded, as the hole is not contiguous. This is known as -------------. a) external fragmentation b) Internal fragmentation c) both a and b d) reallocation

a) external fragmentation

10. Because of virtual memory, the memory can be shared among a) processes b) threads c) instructions d) none of the mentioned

a) processes

13. A page fault occurs when : a) a page gives inconsistent data b) a page cannot be accesses due to its absence from memory c) a page is invisible d) All of these

b) a page cannot be accesses due to its absence from memory

8. Memory management technique in which system stores and retrieves data from secondary storage for use in main memory is called a) fragmentation b) paging c) mapping d) none of the mentioned

b) paging

11. Swap space exists in a) primary memory b) secondary memory c) CPU d) none of the mentioned

b) secondary memory Swap space is a space on a hard disk used as the virtual memory extension of a computer's real memory (RAM).

7. Response time is : a) the total time taken from the submission time till the completion time b) the total time taken from the submission time till the first response is produced c) the total time taken from submission time till the response is output d) None of these

b) the total time taken from the submission time till the first response is produced

6. The interval from the time of submission of a process to the time of completion is termed as a) waiting time b) turnaround time c) response time d) throughput

b) turnaround time

18) Which is non pre-emptive CPU scheduling: a)Round robin b)FIFO c)MQS d)MQSF

b)FIFO

4. Which of the following scheduling algorithms could result in starvation? a. First-come, first-served b. Shortest job first c. Priority d. b and c

b. Shortest job first c. Priority condition where a process does not get the resources it needs for a long time because the resources are being allocated to other processes

14. What is compaction? a) a technique for overcoming internal fragmentation b) a paging technique c) a technique for overcoming external fragmentation d) a technique for overcoming fatal error

c) a technique for overcoming external fragmentation

9. The aim of creating page replacement algorithms is to : a) replace pages faster b) increase the page fault rate c) decrease the page fault rate d) to allocate multiple pages to processes

c) decrease the page fault rate

17) In first-in-first-out page replacement algorithm when a page replacement is required the ------------ in memory is the victim. a) dead page b) Recent page c) oldest page d) Both a and b

c) oldest page

19) What is a shell? a)it is a hardware component b) it is a software component c)it is a command interpreter d) it is a tool in cpu scheduling

c)it is a command interpreter

Q)Enumerate some cons for increasing the page size.

cons: increases page fault latency, as swap response time is slower due to more data. increases internal fragmentation of pages, as there is more 'wasted page' in the working set

3. The UNIX __________ command is used to list the contents of a directory. a. ls b. cat c. cp d. vi

ls

Q)Enumerate some pros for increasing the page size.

pros: reduces pagetable size increases tlb coverage increases swapping I/O throughput, as small disk transaction times are dominated by seek & rotational delays.

Address Space Randomization

randomizes the start location of the stack so that every time the code is loaded in the memory, the stack address changes ASLR makes buffer overflow attack more difficult bc: One of the critical steps in the attack is to find out the address of the malicious code. If the memory is not randomized, each time we run the program, the address will be the same. This makes investigation easy. The ASLR technique changes that, so figuring out the address becomes difficult.

Q) Given three subroutines of 550, 290, and 600 words each, if segmentation is used then the total memory needed is the sum of the three sizes (if all three routines are loaded). However, if paging is used then some storage space is lost because subroutines rarely fill the last page completely, and that results in internal fragmentation. Determine the total amount of wasted memory due to internal fragmentation when the three subroutines are loaded into memory using each of the following page sizes: a. 100 words b. 600 words c. 700 words d. 900 words

skip* Page Size multiplied until close to sub routine, subtract to get wasted words


Set pelajaran terkait

Chapter 23 Genomics II: Functional Genomics, Proteomics, and Bioinformatics

View Set

NASM Corrective Exercise Specialist Quiz Questions

View Set

Anaylyzing a Seminal US Document 100%

View Set

Network+ Guide to Networks - Eighth Edition - Chapter Two

View Set

Powers given to the state/federal government - FEDERALISM

View Set