-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdesign-of-operating-systems.html
113 lines (106 loc) · 6.01 KB
/
design-of-operating-systems.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE HTML>
<html>
<head>
<title>Design of Operating Systems - Eric Weng's Portfolio</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<link rel="stylesheet" href="../assets/css/main.css" />
<style>
.container, .box { text-align: left; }
</style>
</head>
<body class="is-preload">
<!-- Nav -->
<nav id="nav">
<ul class="container">
<li><a href="index.html">Home</a></li>
<li><a href="design-of-operating-systems.html">Design of Operating Systems</a></li>
<!-- Add other navigation links as needed -->
</ul>
</nav>
<!-- Main Content -->
<article class="wrapper style2">
<div class="container">
<header>
<h2>Design of Operating Systems</h2>
<p>Operating system design labs by Eric Weng.</p>
</header>
<section class="box">
<h3>Course Introduction</h3>
<p>This course covers fundamental concepts in operating system design, including <b>memory management</b>, <b>process management</b>, and <b>file management</b>.</p>
</section>
<section class="box">
<h3>Memory Management</h3>
<p>Modify the xv6 virtual memory management to make memory management more efficient includes:</p>
<ol>
<li><b>Copy-on-write forking</b> - This approach minimizes the unused and unneeded memory by delaying the copying of resources until they are actually modified.</li>
<li><b>Lazy zero-page allocation</b> - This method also helps in reducing the unnecessary usage of memory by allocating memory pages only when they are actually needed.</li>
</ol>
<a class="image featured"><img src="images/os-lab2.png" alt=""/></a>
</section>
<section class="box">
<h3>Process Management</h3>
<p>Add threading support to xv6 using clone function where a new process is created and added to a "thread group." In a thread group, processes(threads) share the same memory space and thus need synchronization support. Concurrency control library, such as mutexes and ocnditional variables, is created to coordinate the work of threads and handles issues like data race, lost-wakeup problem, and deadlocks. This lab contains the following implementations:</p>
<ol>
<li>A system call <b>clone()</b> to create a new thread</li>
<!-- <a class="image featured"><img src="images/lab3_threads.png" alt=""/></a> -->
<section class="box">
<h3>Background: Process vs. Thread</h3>
<ul>
<li><strong>Threads have:</strong></li>
<ul>
<li><strong>Shared:</strong></li>
<ol>
<li>address space (pgdir)</li>
<li>file descriptor table (ofile array)</li>
<li>Opening, closing files</li>
<li>Current working directory (cwd)</li>
<li>chdir() syscall</li>
</ol>
<li><strong>Separate:</strong></li>
<ol>
<li>Stack (kernel & user)</li>
<li>Registers</li>
</ol>
</ul>
<li><strong>Processes have:</strong></li>
<ul>
<li>Separate everything (but a lot of it is copied over via fork)</li>
</ul>
</ul>
</section>
<li>A system call <b>waitpid()</b> to wait on a specific process ID</li>
<li>Userspace functions `thread_create()` and `thread_wait()` to allow users to create and wait on threads.</li>
<li>System calls <b>park()</b>, <b>setpark()</b>, and <b>unpark()</b> to address lost wakeup problem.</li>
<a class="image featured"><img src="images/lost-wakeup.png" alt=""/></a>
<li>Userspace functions <b>mutex_init()</b>, <b>mutex_acquire()</b>, <b>mutex_release()</b>, <b>cond_init()</b>, <b>cond_wait()</b>, and <b>cond_signal()</b> to synchronize threading work using the previously defined system calls.</li>
</ol>
</section>
<section class="box">
<h3>File Management</h3>
<p>Provide user isolation and file permission functionalities to xv6. It includes:</p>
<ol>
<li>A user system where each process is created with a logical user identifer</li>
<li>A file permission system where each file's access is controlled by its owner and permission properties.</li>
<li>A login system where a secure mechanism is implemented for storing and retrieving passwords in xv6.</li>
<li>Create <b>sudo()</b> function to temporarily allow a user to execute programs as root. </li>
</ol>
</section>
</div>
</article>
<!-- Footer -->
<footer id="footer" class="wrapper style4">
<div class="container">
<p>© Eric Weng. All rights reserved.</p>
<!-- Additional footer content -->
</div>
</footer>
<!-- Scripts -->
<script src="../assets/js/jquery.min.js"></script>
<script src="../assets/js/jquery.scrolly.min.js"></script>
<script src="../assets/js/browser.min.js"></script>
<script src="../assets/js/breakpoints.min.js"></script>
<script src="../assets/js/util.js"></script>
<script src="../assets/js/main.js"></script>
</body>
</html>