TCSS 422: Operating Systems - Final Quiz Review & Hands-on Tutorial, Exercises of Operating Systems

Final Exam converted to quiz and hands-on tutorial on File Systems. ▫ Slide modifications & refactoring to improve online delivery.

Typology: Exercises

2022/2023

Uploaded on 05/11/2023

gail
gail 🇺🇸

4.9

(10)

222 documents

1 / 40

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
TCSS 422 A – Spring 2021
School of Engineering and Technology
6/3/2021
L19.1
Slides by Wes J. Lloyd
June 3, 2021 TCSS422: Operating Systems [Spring 2021]
School of Engineering and Technology, University of Washington - Tacoma
Be yo nd Phys ical Memor y,
Review for Fina lQuiz
Wes J. Lloyd
Sc hoo l of Engineering and Tec hnolo gy
Un ivers ity of Wash ington - Tacoma
TCSS 422: OPERATING SYSTEMS
Th is is a “c lo ud co mpu ti ng” cou rse
Pr evi ou s ye ar’ s co urs e:
ht t p: // fac ul ty.w as hin gt on .edu/ wl loyd/ co ur ses /t cs s56 2
Co urs e int ro duc es m aj or cl oud c om put in g de liv er y m od els :
In fra struc tu re- as -a -Se rv ice ( Ia aS) , Pl atf or m (PaaS ), Fun cti ons
(F aa S), C on tai ne r (C aaS ), So ftw ar e (Sa aS )
Co urs e fe atu res a s of twa re d eve lo pme nt p ro jec t wh ere we
bu ild a nd eval uate s oft war e en tir ely fo r t he cl ou d
Topi cs : i nt ro duc ti on to m aj or cl oud ser vic es , devel op ing
se r ve rless s of twa re ( Fun ct ion-a s- a-S er vic e) , co nta ineri za tio n
FALL 2021 - TCSS 562
SOFTWARE ENG. FOR CLOUD COMPUTING
June 3, 2021 TCSS422: Operating Systems [Spring 2021]
School of Engineering and Technology, University of Washington - Tacoma L19.2
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28

Partial preview of the text

Download TCSS 422: Operating Systems - Final Quiz Review & Hands-on Tutorial and more Exercises Operating Systems in PDF only on Docsity!

School of Engineering and Technology June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma

Beyond Physical Memory,

Review for “Final” Quiz

Wes J. Lloyd

School of Engineering and Technology

University of Washington - Tacoma TCSS 422: OPERATING SYSTEMS  This is a “cloud computing” course  Previous year’s course: http://faculty.washington.edu/wlloyd/courses/tcss  Course introduces major cloud computing delivery models: Infrastructure-as-a-Service (IaaS), Platform (PaaS), Functions (FaaS), Container (CaaS), Software (SaaS)  Course features a software development project where we build and evaluate software entirely for the cloud  Topics: introduction to major cloud services, developing ser verless software (Function-as-a-Service), containerization FALL 2021 - TCSS 562 SOFTWARE ENG. FOR CLOUD COMPUTING June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19.

School of Engineering and Technology

 Class does not have prerequisites

 TCSS 422 provides good foundation – we use Linux

 If interested in enrolling, contact by email

 Can take 1 x 500-level class, counts as 400-level elective

 SAVINGS: able to take graduate course and only pay

undergraduate tuition

 DOUBLE-DIP !!

 Class taken in last quarter of undergrad can be used twice

 Once as a undergraduate elective towards graduation  Once as a graduate elective towards the Masters in Computer Science & Systems (MSCSS) degree June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. TCSS 562 – CLOUD COMPUTING - 2  Independent study in “cloud computing”  Work to collaboratively draf t a proposal and submit to Dr. Nascimento, CSS Chair F 2021 for approval  Focus on variety of topics related to cloud/distributed systems  Variable credits from 1 to 5  Involves par ticipation in weekly research group meeting  Spring 2021: currently Wednesday at 12:30p  Usually 1 or 2 one-on-one or small group meeting during week  Contact by email if interested  Identify preferred quar ter(s)  Number of credits  Can take up to 10 credits TCSS 498/499 - CSS elective credits NEXT YEAR - TCSS 498/499 (ANY QUARTER) UNDERGRADUATE READING/RESEARCH IN CSS June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19.

School of Engineering and Technology  Daily Feedback Quiz in Canvas – Available After Each Class  Extra credit available for completing surveys ON TIME  Tuesday surveys: due by ~ Wed @ 11:59p  Thursday sur veys: due ~ Mon @ 11:59p June 3, 2021 TCSS422: Computer Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. ONLINE DAILY FEEDBACK SURVEY June 3, 2021 TCSS422: Computer Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19.

School of Engineering and Technology  Please classify your perspective on material covered in today’s class (42 respondents):  1-mostly review, 5-equal new/review, 10-mostly new  Average – 6.37 ( - previous 6.02)  Please rate the pace of today’s class:  1-slow, 5-just right, 10-fast  Average – 5.46 ( - previous 5.52) June 3, 2021 TCSS422: Computer Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. MATERIAL / PACE June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. FEEDBACK

School of Engineering and Technology

 Assignment 3 provides an introduction to kernel

programming by demonstrating how to create a

Linux Kernel Module

 Kernel modules are commonly used to write device

drivers and can access protected operating system data

structures

 For example: Linux task_struct process data structure

 Assignment 3 is scored in the Quizzes / Activities /

Tutorials category

 Lowest two grades in this category are dropped

June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. ASSIGNMENT 3: INTRODUCTION TO LINUX KERNEL MODULES

 Questions from 6/

 Tutorial 2 – Pthread, locks, conditions tutorial – June 4

 Assignment 3: (Tutorial) Introduction to Linux Kernel Modules

 Final exam – alternate format

 Quiz 4 – Page Tables

 Chapter 20: Paging: Smaller Tables

 Example Question

 Chapter 21/22: Beyond Physical Memory

 Swapping Mechanisms, Swapping Policies

 Practice Questions for “Final” Quiz

 5:45 pm – Life After TCSS 422: CSS Career Panel

 w/ Soft Eng from UWT CSS Jugal and Navid (eBay and T-Mobile) June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. OBJECTIVES – 6/

School of Engineering and Technology  Final Exam category will have two assignments  Thursday June 10 from 3:40 to 5:40 pm  Final Quiz (50 points)  SHORT: fewer than half the number of questions as the midterm  1-hour  Focus on new content - since the midterm  Tutorial: Linux File Systems and Disk I/O  Available for 1-week ~June 5th^ to June 11th  50 points  Presents new material in a hands-on, interactive format  Complete activity and answer questions  Individual work June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. ALTERNATE FINAL EXAM

 Questions from 6/

 Tutorial 2 – Pthread, locks, conditions tutorial – June 4

 Assignment 3: (Tutorial) Introduction to Linux Kernel Modules

 Final exam – alternate format

 Quiz 4 – Page Tables

 Chapter 20: Paging: Smaller Tables

 Example Question

 Chapter 21/22: Beyond Physical Memory

 Swapping Mechanisms, Swapping Policies

 Practice Questions for “Final” Quiz

 5:45 pm – Life After TCSS 422: CSS Career Panel

 w/ Soft Eng from UWT CSS Jugal and Navid (eBay and T-Mobile) June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. OBJECTIVES – 6/

School of Engineering and Technology  Consider a 16 MB computer which indexes memory using 4KB pages  (#1) For a single level page table, how many pages are required to index memory?  (#2) How many bits are required for the VPN?  (#3) Assuming each page table entr y (PTE) can index any byte on a 4KB page, how many of fset bits are required?  (#4) Assuming there are 8 status bits, how many bytes are required for each page table entry? June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. MULTI-LEVEL PAGE TABLE EXAMPLE  (#5) How many bytes (or KB) are required for a single level page table?  Let’s assume a simple HelloWorld.c program.  HelloWorld.c requires virtual address translation for 4 pages:  1 – code page 1 – stack page  1 – heap page 1 – data segment page  (#6) Assuming a two-level page table scheme, how many bits are required for the Page Director y Index (PDI)?  (#7) How many bits are required for the Page Table Index (PTI)? June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. MULTI LEVEL PAGE TABLE EXAMPLE - 2

School of Engineering and Technology  Assume each page directory entry (PDE) and page table entr y (PTE) requires 3 bytes:  6 bits for the Page Directory Index (PDI)  6 bits for the Page Table Index (PTI)  8 status bits  (#8) How much total memory is required to index the HelloWorld.c program using a two-level page table when we only need to translate 4 total pages?  HINT: we need to allocate one Page Directory and one Page Table…  HINT: how many entries are in the PD and PT June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. MULTI LEVEL PAGE TABLE EXAMPLE - 3  (#9) Using a single page directory entry (PDE) pointing to a single page table (PT), if all of the slots of the page table (PT) are in use, what is the total amount of memor y a two-level page table scheme can address?  (#10) And finally, for this example, as a percentage (%), how much memory does the 2-level page table scheme consume compared to the 1-level scheme?  HINT: two-level memory use / one-level memor y use June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. MULTI LEVEL PAGE TABLE EXAMPLE - 4

School of Engineering and Technology

CHAPTER 21/22:

BEYOND PHYSICAL

MEMORY

June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19.

 Disks (HDD, SSD) provide another level of storage in the

memory hierarchy

June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19.

MEMORY HIERARCHY

School of Engineering and Technology

 Provide the illusion of an address space larger than

physical RAM

 For a single process

 Convenience

 Ease of use

 For multiple processes

 Large virtual memory space supports running

many concurrent processes...

June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. MOTIVATION FOR EXPANDING THE ADDRESS SPACE June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. LATENCY TIMES  Design considerations:

 SSDs 4x the time of DRAM

 HDDs 80x the time of DRAM

 Latency numbers ever y programmer should know  Fr o m : htt ps://gist.g ithub.co m/jboner/28 41 83 2# file-latency -t xt

School of Engineering and Technology  The size of the swap space can be seen using the Linux free command: “free –h”  With sufficient disk space, a common allocation is to create Swap space greater than or equal to physical RAM June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. SWAP SPACE - 2  Swap space lives on a separate logical volume in Ubuntu Linux that is managed separately from the root file system  Check logical volumes with “sudo lvdisplay” command:  See also “lvm lvs” command June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. SWAP SPACE - 3

School of Engineering and Technology

 Memory pages are:

 Stored in memory

 Swapped to disk

 Present bit

 In the page table entry (PTE) indicates if page is present

 Page fault

 Memory page is accessed, but has been swapped to disk

June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. PAGE LOCATION

 OS steps in to handle the page fault

 Loading page from disk requires a free memory page

 Page-Fault Algorithm

June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. PAGE FAULT

School of Engineering and Technology

REPLACEMENT

POLICIES

June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. 7  Replacement policies apply to “any” cache  Goal is to minimize the number of misses  Average memory access time (AMAT) can be estimated:  Consider TM = 100 ns, TD = 10ms  Consider Phit = .9 (90%), Pmiss =.  Consider Phit = .999 (99.9%), Pmiss =. June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19.

CACHE MANAGEMENT

𝐴𝑀𝐴𝑇 = 𝑃ு௜௧ ∗ 𝑇ெ + (𝑃ெ௜௦௦ ∗ 𝑇஽) Argument Meaning 𝑇ெ The cost of accessing memory (time) 𝑇஽ The cost of accessing disk (time) 𝑃ு௜௧ The probability of finding the data item in the cache(a hit) 𝑃ெ௜௦௦ The probability of not finding the data in the cache(a miss)

School of Engineering and Technology  What if:  We could predict the future (… with a magical oracle)  All future page accesses are known  Always replace the page in the cache used farthest in the future  Used for a comparison  Provides a “best case” replacement policy  Consider a 3-element empty cache with the following page accesses: 0 1 2 0 1 3 0 3 1 2 1 June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. OPTIMAL REPLACEMENT POLICY

What is the hit/miss ratio?

6 hits

 Queue based

 Always replace the oldest element at the back of cache

 Simple to implement

 Doesn’t consider importance… just arrival ordering

 Consider a 3-element empty cache with the following

page accesses:

0 1 2 0 1 3 0 3 1 2 1

 What is the hit/miss ratio?

 How is FIFO different than LRU?

June 3, 2021 TCSS422: Operating Systems [Spring 2021] School of Engineering and Technology, University of Washington - Tacoma L19. FIFO REPLACEMENT

4 hits

LRU incorporates history