C191: Operating Systems Study Guide Hardware and User Needs Memorize and complete the following table from Section 1.1 in Zybooks: Hardware Hardware Components User Needs Component CPU Examples of the Hardware Machine instructions perform The user thinks in The control Unit, operations on contents of registers terms of arrays, lists Arithmetic Logic Unit, and memory locations. and other high-level registers, Cache data structures, accessed and manipulated by other high-level operations Main Physical memory is a linear The user must manage Primary Memory – RAM Memory sequence of addressable bytes or a heterogenous (Random Access words that hold programs and data collection of entities of Memory, stores the various types and sizes data that the CPU and sizes, including actively uses during source and executable program execution. programs, library SRAM, DRAM functions and dynamically allocated data structures, each accessed by different operations. HDD, SSD, Flash drives, Secondary Disk and other secondary storage The user needs to magnetic tape, memory Storage devices are multi-dimensional access and manipulate cards structures, which require complex programs and data sets sequences of low-level operations of various sizes as to store and access data organized individual named in discrete blocks. entities without any knowledge of the disk organization I/O Device I/O devices are operated by reading The user needs simple, Keyboards, printers, and writing registers of the device uniform interfaces to screens etc. controllers. access different devices without detailed knowledge of the access and communication protocols. History of Computers Memorize and complete the following table from Section 1.3 in Zybooks: Generation Generation 1 Enabling Hardware Technology Vacuum Tubes OS type None Defining Characteristics All programming was done by experts in machine language without any support from an OS or any other system software. Generation 2 Transistors Batch Programs were submitted in batches of punch cards. The role of the OS was to automate the compilation, loading and execution of programs. Multiprogramming was developed, which allows the OS to schedule the execution of jobs to make more efficient use of the CPU and other resources. Generation 3 Integrated circuits allowed the Multi-programming, Interrupts were development of microchips to multi-tasking developed to allow the replace individual transistors Interactive multi-user OS to enforce time- OS sharing and to interact with keyboards and display terminals, also developed during the same period. Increased capacity and speed of memory and secondary storage devices imposed additional management tasks on the OS. Generation 4 Very Large-Scale Integration VLSI Multi-processor. The OS was responsible allowed the placement of a for all operations, complete microprocessor on a starting from the initial single chip, leading to the booting, to development of personal multitasking, computers. scheduling, interactions with various peripheral devices and keeping all information safe. The emphasis was on userfriendliness, including the introduction of the GUI. Generation 5 Networking hardware enabled the OS for supercomputers The ability to create harnessing of the power of and mobile devices extremely powerful multiple computers. chips spawned several directions of development. Supercomputers combined large numbers of processors and made the OS and other software responsible for exploiting the increased computation power through parallel processing. Computer networks gave rise to the internet, which imposed requirements of privacy and safety along with the efficient communication. Wireless networks led to the development of hand-held devices with additional demands on the OS. Windows and Linux Commands Use your book, additional resources, and the internet to memorize and complete the table: Operation Definition Windows Windows GUI Linux Command cd path/directory Command (Command Prompt) Change Change the current cd Double working directory to path\to\director clicking in fire another directory Create explorer Create a new named Mkdir directory Right click Mkdir directory name select new directoryname folder Delete Delete directory from rd /s Right click and rm -r the path (and deletes directoryname delete directoryName Move a directory to move source Drag, or cut mv source dest another destination and paste Rename Rename a file directory rename old new mv oldname new List List all the file names dir ls -l all the files and directories nested within the deleted directory) Move and other attributes within a specified file name Find Find a file or directory Wildcard: * by name Locate Print Mounting File System dir /s /b Print to screen echo Text locate echo “text” moutn Unmounting File System Ping ping ping <hostname or ip> Ipconfig Display File Contents Stream Editor for Editing Text Security Questions Memorize and complete the following table from Chapter 16 in Zybooks: Type of Also Key for Key for Algorithm Describe the Cryptography known Encryption Decryption Used for Cryptography as… (Circle one) (Circle one) Encryption (Circle one) Symmetric Secret / Private / Private DES / Key Symmetric encryption uses the same key for both encryption and decryption of data. It relies on the secrecy of the single key, which must be shared with the user doing the decryption. Asymmetric public Public/ / Private RSA / Asymmetric encryption uses a pair of keys, public to send and private to receive and decrypt. Only the holder of the private key can decrypt the data. It benefits from not needing to share keys for decryption. What is a man-in-the-middle attack? Attacker secretly listens to and possibly alters communication between two systems. What is a logic bomb? Unauthorized code inserted into the system and executed at a specified time to perform some destructive action. What is a back door? A mechanism that bypasses user authentication What is a trapdoor? Similar to a backdoor, A secret entry point that allows unauthorized access to a system. What is information leaking? The disclosure of confidential or secret information by a legitimate user to an unauthorized user. When someone from inside the organization poses a threat with information, what is that called? Insider Threat What is login spoofing? A legitimate user presents a fake login screen to an unsuspecting user who unwittingly supplies a valid login name and password to the imposter program How is login spoofing different from phishing? Phishing is not an insider attack How is login spoofing different from social engineering? Login spoofing is performed by someone who already has access, social engineering does not necessarily require access and can be performed from the outside. What are the differences between a virus and a worm? A virus attaches itself to a legitimate program or file and spreads by inflecting other files or programs. A worm is a standalone program that doesn’t require a host program to spread. What is a trojan horse? A trojan horse is malware that pretends to be a legitimate program and is downloaded by the user but has hidden functions intended to violate computer security. What is a buffer overflow attack? An intrusion technique that exploits the fact that many programs do not check for array overflow, allowing an attacker to overwrite portions of memory beyond the legitimate scope of an input buffer. When a bad actor adds code to a form online that exposes customer information later is that a buffer overflow attack or a logic bomb? Logic Bomb Why should developers use a sandbox? When testing an known or new software from an known source or that may produce unknown events. It keeps the user system protected and isolates the tested program. What is a hash? A hash is a value that is generated from a string of text, usually a data input of any length. What is a DDoS attack? Distributed Denial of Service attack. – An attempt to disrupt the regular functioning of a targeted server, service or network. The DDoS overwhelms the target with a flood of internet traffic, usually generated by botnets. What does defense in depth mean? The theory that more layers of defense provide stronger defense than fewer layers. Describe Salting using a picture: What is Dropbox? A cloud-based file storage and synchronization service that allows users to store, share and access files and folders across various devices. What can be used to access Dropbox? Dropbox is accessed via the internet or another WAN There are three types of factors of authentication: something you have, something you know, something you are. Describe and provide an example of each: Something you know: The color of your first car / mother’s maiden name. Something you are (also known as biometrics): retinal scan, finger / palm scan Something you have: A keycard, a password, In cybersecurity, there is a principle of least privilege. Define the following: Principle of least privilege: A design principle stating that every program and every privileged user of the system should operate using the least amount of privilege necessary to complete the job. Role-Based Access Control (RBAC): Role-Based Access Control – A security model and access control mechanism used to manage and control access to resources within a system or application. RBAC assigns permissions to users based on their roles, making it easier to manage access rights and maintain security. Roles: Roles are predefined sets of permissions that define what actions or operations a user is allowed to perform. For example, roles might include administrator, user, manager, etc. Discretionary Access Control: Allows the owner of a resource like a file or folder to control who has access to that resource and what level of access they have. Mandatory Access Control: Enforces strict control over access to resources based on predefined security policies and labels. In MAC, access decisions are determined by the system administrator or security policies rather than the owner. Access and Capabilities List For capabilities lists, find the object and work down that column For access lists, find the domain and work across that row What does * or c mean in an access list? (Hint: you may need to look in the course tips or announcements) The holder of rc may copy r to another domain. Memory Questions What is an example of physical memory and its limitations? A computer’s physical memory is a hardware structure consisting of a linear sequence of words that hold a program during execution. It can be damaged and requires physical space to store, it is generally slower. What is logical memory and why is it used? Logical / virtual memory is a memory management that is used to provide the illusion of a larger memory space than is physically available. It allows programs to use more memory than is actually installed. When memory is considered volatile, what does that mean? Volatile memory is only active while the system is powered, when the power is turned off the programs in volatile memory disappear. When memory is considered nonvolatile, what does that mean? Nonvolatile memory retains data when the power supply is turned off or interrupted. and is used for long term data retention. What is DMA and when is it used? Direct memory access controller is a hardware controller that allows devices to access main memory directly, without involvement of the CPU Paging Using Chapter 7 in your Zybooks, complete the following table: Term Definition Metaphor Page Table An array that keeps A “phone book” of track of which where data resides pages of a given logical address space reside in which page frames. Page A fixed-size A “page” of a contiguous block of phone book physical memory identified by a single number, the page number Page Frame a fixed-size An “ad” of a phone contiguous block of book physical memory identified by a single number, the page frame number. Why do we use a page table? A page table is used to map virtual addresses to their corresponding physical addresses. How does a page relate to a logical address space? The logical address space is divided into fixed-size blocks, these are called pages. How does a page frame relate to a physical address? A page frame is a fixed-size block of physical memory, it is equivalent in size to a page in the logical address space. Define the following: Logical Address, Logical Address Space, and Physical Address. A logical address is an integer in the range[0:m-1] that identifies a word in the logical address space. A logical address space is an abstraction of physical memory, consisting of a sequence of imaginary memory locations in a range [0:m-1], where the size of m is the size of the logical address space. A physical address in an integer in the range[0:n-1] that identifies a word in the physical memory of size n. Page Replacement What is a page replacement and page fault rate? Page replacement is the act of overwriting a page in memory with a different page loaded from the disk when needed. A page fault rate is the number of page faults, f, occurring during a number of memory references, t. The page fault rate can be expressed as P=f/t, What is the best page replacement algorithm? The optimal page replacement algorithm selects the page that will not be referenced for the longest time in the future. Which page replacement algorithm results in the fewest number of page faults? The optimal page replacement algorithm. What is the optimal page replacement algorithm? The optimal page replacement algorithm selects the page that will not be referenced for the longest time in the future. What is the FIFO page replacement algorithm? The FIFO page replacement algorithm selects the page that has been resident in the memory for the longest time. What is the LRU page replacement algorithm? The least-recently-used page replacement algorithm selects the page that has not been referenced for the longest time. What is the Aging Replacement algorithm? The aging page replacement algorithm does not maintain pages sorted in the exact LRU order, but groups together pages referenced during a period of d consecutive references. Each period is represented by 1 bit in a periodically shifting aging register. Describe the process that occurs in the second chance page replacement algorithm: The r-bit divides all pages into only two categories, recently referenced and not recently referenced. A page is then selected from the not-recently referenced category. Describe the process that occurs in the third chance page replacement algorithm: The NRU ( not-recently-used) algorithm is a coarse-grain approximation of LRU, which divides pages into 4 categories based on the 4 possible combination of the r-bit and the m-bit. What is the Working Set algorithm? A trailing window of size d is superimposed on the RS to determine the size and composition of the working set at time t. What is the Optimal Working Set algorithm? A set of resident pages that will still be needed in the immediate future and thus should remain resident. What is the Working Set Page Replacement Algorithm? The most relevant pages of a process are kept in memory, reducing page faults and improving performance. What is the Page Fault Frequency Replacement Algorithm? – Adjusts the current resident set based on how frequently consecutive page faults occur. What is thrashing? An execution state during which most of the time is spent on moving pages between the memory and the disk while the CPU is mostly idle and no process is making any real progress. Fragmentation What causes the following types of fragmentation: Internal: A mismatch between the page size and the size of the program that creates a hole at the end of the programs last page. External: The loss of useable memory space due to holes between allocated blocks of variable sizes. What is a boot partition? A storage device containing an executable operating system. Draw a diagram showing the user powering up their computer and initiating the boot partition, boot sector, boot kernel, and OS: Power ON -> Master boot record { boot code / partition table} | boot partition | boot sector | boot kernel -> Loaded OS In the 50% rule, how much of memory is wasted on average? (Circle one): 1/3 Memory Management Define and draw a picture of memory Define and draw a picture of memory swapping: compaction: In compaction, The blocks are moved to make space for the new request. Segmentation and Segment Tables What is the difference between a segment table and page table? Define the following terms using Chapter 8 in your Zybooks: Term Definition Potential ways to remember it on the exam Segment A variable size block of logical address Smallest unit of data for memory management space identified by a single number, the segment number Segment Table An array that keeps track Each entry corresponds to of which segment resides one segment and contains in which area of physical the starting address of the memory. Each entry segment corresponds to one segment and contains the starting address of the segment. Address Translation Address translation in Like paging within a segments allows a segment program to use a larger address space while maintaining efficient memory management. TLB A fast associative memory Like remembering where buffer that maintains the local stores are around recent translations of your house without having logical addresses to to use GPS to get there frames in physical faster. TLB saves the memory for faster logical -> physical retrieval address translation with the frame number Hit Ratio The fraction of memory component If found, easier to get accesses that find a match there sooner and less in the TLB. The higher the overhead used. (Easier to TLB hit ration, the lower get to the store without the GPS if you know it by muscle memory) Principle of Locality Locations accessed We are creatures of habit – recently are more likely to if we did something be accessed again than before, chances are we are locations accessed in the going to do it again soon distant past. Types of Memory Fits Use Chapter 7 in your Zybooks to complete the following table: Draw a picture and define best fit: Draw a picture and define worst memory fit: Searches the entire list and chooses the Always chooses the largest available hole for smallest hole large enough to any request. accommodate the request Draw a picture and define next memory fit: Draw a picture and define first memory fit Starts the search at the point of the last Starts from the beginning of the list and allocation. allocates the first hole large enough to accommodate the request. Processes and Threads A program in execution is called: A process What is a PCB and what is it purpose? A data structure that holds information for a process, including the current instruction address, the execution stack, the set of resources used by the process and the program being executed. How many threads are there to a process? One to many How many processes are there to a PCB? A single process What is a program counter? A CPU register indicating the main memory location of the next instruction to load and execute. While the acronyms may be similar, PC and PCB are completely different. Describe their impact on processes and threads: A program counter keeps track of the process that currently has access to the CPU, the processes control block handles the threads and the completion of the process itself. File Control and Directory Define and provide an example of each for the layered file system diagram below: A program designed for end-user execution. Microsoft Word is meant to be used by the user and runs on top of the operating system. A logical layer of the operating system responsible for file and file-system metadata management, maintains the FCB File-organization module – A logical later of the operating system responsible for files and for translation of logical blocks to physical blocks. basic file system- A logical layer of the operating system responsible for issuing generic commands to the I/O control layer, such as “read block x” and also buffering a caching I/O. I/O control – A logical layer of the operating system responsible for controlling I/O, consisting of device drivers and interrupt handlers. Devices are the input and output suppliers, keyboards, printers etc. run by device drivers which manage their actions with the system. List 4 things that a file system must be able to do: 1. Store large amounts of data 2. Metadata 3. Control over access 4. Maintain data integrity Select the correct answers: 1. Where are files stored in UNIX? (Select 1.), UFS, 2. Where are files stored in Windows? (Select 3.) NTFS, FAT or FAT32 3. Where are files stored in Linux? (Select 2.) ext3, ext4, Reminder: Look at the course announcements and resources for additional information on NTFS and ext3/ext4 not covered in the textbook, but required for the OA Define the three ways what a file type can be identified: 1. Magic Number: Short sequence of characters at the start of the file header, which identifies the file type. 2. File Header: A portion of the file preceding the actual data and is visible only to the FS itself. 3. File Extension: A sequence of one of more characters following the file name. Why is a file extension the most vulnerable to corruption issues? It can easily be changed Using the picture below from Windows, square the relative path name and circle the absolute path name for this folder: Relative path is This PC > Downloads > Test Absolute path name is C:\Users\chris\Downloads\Test Define the following terms: File Directory or Folder: A special purpose file that records information about other files and possibly other directories. Root: The highest level directory, which does not have a parent directory. Relative Path Name: A concatenation of file names starting with the current directory. Absolute Path Name: The full path name of the file, leading down to the file root Draw a Picture Directed Acyclic Directory Symbolic Link Directory Structure Structure Define the Term Directories organized such Symbolic links point to a file that any directory at a given or directory like a regular level may point to zero or entry but are treated more files or other differently with respect to directories at lower levels deletion. Deletion removes but also permits any file or the link but not the original directory to have more than file. one parent directory. What does FCB stand for? File control block Describe the following picture from Zybooks and why approach 3 is used within the file control block: The critical attributes are kept in the directory. All other attributes are kept in file control blocks. This prevents the directory from getting too large. Define PCB: Process control block, a data structure that holds information for a process, including the current instruction address, the execution stack, the set of resources used by the process and the program being executed. Define FCB: File Control Block – A data structure associated with a filename that contains all relevant attributes of the file. FCBs are stored apart from file directories and are pointed to by the corresponding directory entries. Identify if the following pictures are either Contiguous, Clustered, or Linked and define the term: Contiguous – Every file is mapped into a contiguous sequence of disk blocks. Linked – blocks containing a file may be scattered throughout the disk. The FCB points to the first block and each points to the logically next block. Clustered – The last block of any clucster points to the beginning of the logically next cluster. Operation Describe what happens with the file and FCB Create File Causes the creation of a new named file, the FS allocates and initializes a new FCB. Destroy File Removes an existing file from the FS. Reversed the process of creation freeing up the files FCB and directory entry. Open File A data structure that keeps track of all files currently in use to facilitate Table efficient access to and manipulation of the files. Open File Prepares a file for efficient access and manipulation by retrieving relevant file information from the FCB and storing the information in an entry of the OFT. Read File Copies data from an open file to a specified area in main memory. Write Copies data from an area in main memory to a specified open file. Seek Moves the current position of an open file to a new specified position. Which accounts can destroy a file? The owner How does Windows present a common interface for all system calls to avoid complex per-program coding? The windows GUI, represented as digital clickable files on the interface. Memory Management Complete the following table by filling in the blanks of either the term or definition: Term Definition Raw No file system is used. Can be used for a Unix Swap Space Cooked disk A disk that contains a file systems Bootstrap loader (boot loader) Stored in firmware, finds the kernel (by knowing the file system) and starts executing it when the system is powered on Boot control block (per volume) Contains information needed by the system to boot an operating system from that volume. If the disk does not contain an operating system, this block can be empty. Partition Boot Sector What the boot block is called in NTFS Volume control block Contains volume details (number of blocks, size of blocks, and free block pointers) What is mounting? Making a file system available to the operating system and users, when mounted, a file system becomes accessible. What are the steps for mounting a table? I can’t find this ? Step 1: Specify source and target Step 2: Issue the mount command Step 3: Access the mounted file system What is mount used for within the Linux operating system? It us used for attaching file systems to the existing file system hierarchy. What is memory mapping? Mapping a disk block to a page or pages in memory. The What is memory-mapped I/O? A shared memory used two or more different processes. I/O Term Port Definition A communication address, each fo separate communication. A connection point for devices to attach to computers Bus A communication system within a computer, connecting varius components such as the CPU and I/O devices, allowing them to transfer data and commands. Daisy Chain A connection method involving connecting devices to each other in a string. Device Driver A device-specific program that implements I/O operations, requested by user applications or the OS, by interacting with the device controller. Device Controller An electronic circuit capable of operating specific I/O devices using binary signals. Which is a piece of hardware: device controller Which interacts with the operating system and translates information from the I/O device into genetic system call? Device Driver Which storage device is directly connected via a serial bus? Serial ATA hard drives and solid state drives Which two are directly connected to a computer? (Select 2.) Host-attached, Cloud Storage Polling vs. Interrupts Which system call method is like asking “…are we there yet?...” because it is repeatedly checking to see if the /O device is available or busy waiting? Polling Which system call method only announces itself once it has arrived? Interrupt Describe how interrupts work with the interrupt request line and what ‘maskable’ means. The interrupt-request line is a hardware connection to the CPI on which interrupts are signaled. The CPU senses it after executing every instruction. When a controller has asserted a signal on the interrupt-request line, the CPU performs a state save and jumps to the interrupt-handler routine. Disk Scheduling Fill in the following diagram with the following words: Track, Sector, Cylinder, Shaft. Each word may be used more than once. Fill in the terms within the following table: Term Definition track One or many concentric rings on a magnetic disk surface sector Smallest portion of a track that can be read or written to via a single r/w operation. Each sector r/w data in blocks. seek time Proportional to the distance traveled Time to move the r/w from the current position to the track containing the right data 1 Proportional to 2disk revolution Time to wait for the desired sector/data item to pass under the r/w head transfer rate Proportional to the disk’s speed Time to transfer the desired bits to/from the disk Also transfer rate? There Data streamed to or from the disk once the head is at the is no specific question beginning of the sector to be transferred that I can find like this. transfer rate The rate at which the data can transfer continuously head crash R/W head collides with the platter and causes damage rotational latency? Speed changes because the outer edges of the track hold 40% more sectors than the inner tracks Maintains transfer rate and density per track Maintains speed Changes transfer rate Disk Access Optimization Assume that the R/W head is at track 50 and needs to go to the following tracks (in no particular order): 0, 10, 55, 70, 100, and 105. Draw what it would look like under the shortest seek time algorithm: Define the shortest seek time algorithm: 55, 70, 10, 0 100. 105 Draw what it would look like under the C-Scan algorithm: Define the C-Scan algorithm: 55, 70 100, 105, 0, 10 Draw what it would look like under the Scan algorithm: 10, 0, 55, 70, 100, 105 Define the Scan algorithm: The r/w head maintains a current direction of travel and services all requests sequentially in the current direction. When the outermost request is reached, the direction is reversed and the algorithm services all requests in the opposite direction.