comparison slide.md @ 3:623da64aac7a default tip

Internship_presentation
author shivanidubey
date Mon, 24 Jun 2019 13:05:55 +0900
parents 54dd75a92d04
children
comparison
equal deleted inserted replaced
2:54dd75a92d04 3:623da64aac7a
1 title: Studying Operating System Using Docker Platform 1 title: Studying Operating System Using Docker Platform
2 author: Shivani Dubey 2 author: Shivani Dubey
3 profile: Madan Mohan Malaviiya, University of Technology 3 profile: Madan Mohan Malaviya University of Technology, Gorakhpur
4 4
5 ## Why we study Operating System? 5 ## Why do we study Operating System?
6 6
7 - Every computer system has an operating system, which manages the resource of the computer. 7 - Every computer system has an operating system, which manages the resources of the computer.
8 8
9 - IoT or IT Services can't work well without resource manageents. 9 - IoT or IT Services can't work well without resource managements.
10 10
11 - To handle it, we have to understand the API of OS 11 - To handle it, we have to understand the API of OS.
12 12
13 - To understand the API, it it better to see the implentations. 13 - To understand the API, it is better to see the implementations.
14 14
15 - For an example, API for tuning priorities of the processess 15 - For example, API for tuning priorities of the processes.
16 16
17 ## Xv6 Operating System as an educational tool 17 ## Xv6 Operating System as an educational tool
18 18
19 - A Unix-like operating system developed in MIT, based on V6 kernel. 19 - A Unix-like operating system developed in MIT, based on V6 kernel
20 20
21 - xv6 is written in ANSI C ( not in C++ ). 21 - xv6 is written in ANSI C ( not in C++ )
22 22
23 - xv6 is small and simple (9628 lines of codes) 23 - xv6 is small and simple (9628 lines of codes)
24 24
25 - It can run on Respberry Pi ( Small PC board ) 25 - It can run on Raspberry Pi ( Small PC board )
26 26
27 - Or on ARM emulator such as QEMU 27 - Or on ARM emulator such as QEMU
28 28
29 ## Xv6 development envrionment with QEMU 29 ## Xv6 development environment with QEMU
30 30
31 - QEMU emulates ARM CPU with virtual memory 31 - QEMU emulates ARM CPU with virtual memory
32 32
33 - Xv6 operating sytem itself is running on QEMU 33 - Xv6 operating sytem itself is running on QEMU
34 34
35 - gdb debugger can be attached to the emulated program (both in user space and system space) 35 - gdb debugger can be attached to the emulated program (both in user space and system space)
36 36
37 - We can step and trace the internal of xv6 kernel 37 - We can step and trace inside xv6 kernel
38 38
39 ... but it requires complex development envrionments setup 39 ... but it requires complex development environments setup
40 ... very time consuming 40 ... very time consuming
41 41
42 ## Our development envrionments 42 ## Our development environments
43 43
44 - emacs editor (amidst the editor war between vi and emacs!)
45 44
46 - homebrew (it simplifies installation of software in macOS) 45 - homebrew (it simplifies installation of software in macOS)
47 46
48 - Mercurial repository of the lab where we saved everything using ssh 47 - Mercurial repository of the lab where we saved everything using ssh
49 48
55 54
56 ## Introducing Docker 55 ## Introducing Docker
57 56
58 - What is Docker? It is a container. 57 - What is Docker? It is a container.
59 58
60 - What is Container? An isolateed envriornment such as file system. 59 - What is Container? An isolated envirornment such as file system.
61 60
62 - It has DockerFile, which describes how to setup the envrionment in the container 61 - It has DockerFile, which describes how to setup the envrionment in the container.
63 62
64 - Docker can run on any computer using an emulator such as QEMU 63 - Docker can run on any computer using an emulator such as QEMU.
65 64
66 - Complex develement environment can be build using DockerFile and docker built command. 65 - Complex development environment can be build using DockerFile and docker built command.
67 66
68 # The DockerFile 67 # The DockerFile
69 68
70 ``` 69 ```
71 FROM phitek/qemu-arm 70 FROM phitek/qemu-arm
76 COPY ["src", "."] 75 COPY ["src", "."]
77 RUN make 76 RUN make
78 CMD /bin/bash 77 CMD /bin/bash
79 ``` 78 ```
80 79
81 - FROM lines specifies the shared image in Docker repository. 80 - FROM line specifies the shared image in Docker repository.
82 81
83 - apt-get install Linux cross compiling tools 82 - apt-get installs Linux cross compiling tools.
84 83
85 - then it create workig directory, and copy our sources to it, and execute make 84 - Then it creates working directory, copies our sources to it, and executes make.
86 85
87 ## Docker command 86 ## Docker commands
88 87
89 - create docker imagae and environment, and built xv6 kernel 88 - Create docker image and environment, and build xv6 kernel
90 89
91 docker build --tag xv6-docker . 90 docker build --tag xv6-docker
92 91
93 - run xv6 kernel on QEMU in the container 92 - Run xv6 kernel on QEMU in the container
94 93
95 docker run --rm --privileged -it xv6-docker ./run-debug.sh 94 docker run --rm --privileged -it xv6-docker ./run-debug.sh
96 95
97 - run gdb to connect the xv6 kernel running in the QEMU 96 - Run gdb to connect the xv6 kernel running in the QEMU
98 97
99 docker exec -it xv6-docker ./debug.sh 98 docker exec -it xv6-docker ./debug.sh
100 99
101 ## Features of Docker:
102
103 - Easy and Faster Configuration
104
105 - Increases productivity
106
107 - Application Isolation
108
109 - Provies Services
110
111 - Security Management
112 100
113 101
114 # Exercise : adding priorities to the xv6 scheduler 102
103
104 # Exercise : Adding priorities to the xv6 scheduler
115 105
116 - Added getpriority() and setpriority() 106 - Added getpriority() and setpriority()
117 107
118 - get_highest_priority() functions in proc.c file of xv6 108 - get_highest_priority() functions in proc.c file of xv6
119 109
120 - implement it in schelduler() 110 - Implemented it in schelduler()
121 111
122 - Added a test function testpriority() in usertests.c file of xv6 to implement our algorithm 112 - Added a test function testpriority() in usertests.c file of xv6 to implement our algorithm
123 113
124 ## The function 114 ## Function used in our exercise to find highest priority process
125
126 ```c 115 ```c
127 int get_highest_priority_proc(void) 116 int get_highest_priority_proc(void)
128 { 117 {
129 int highest_priority; 118 int highest_priority;
130 int pid = 0; 119 int pid = 0;
131 int hpid = -1; 120 int hpid = -1;
132 int rpid = 0; 121 int rpid = 0;
133
134 highest_priority=100; 122 highest_priority=100;
135 struct proc *p; 123
124 struct proc *p;
136 for(p = ptable.proc; p < &ptable.proc[NPROC]; p++, pid++){ 125 for(p = ptable.proc; p < &ptable.proc[NPROC]; p++, pid++){
137 if(p->state != RUNNABLE) { 126 if(p->state != RUNNABLE) {
138 continue; 127 continue; }
139 }
140 rpid = pid; 128 rpid = pid;
141 if (highest_priority > p->priority) { 129 if (highest_priority > p->priority) {
142 highest_priority=p->priority; 130 highest_priority=p->priority;
143 hpid = pid; 131 hpid = pid; } }
144 }
145 }
146 return hpid > 0?hpid:rpid; 132 return hpid > 0?hpid:rpid;
147 } 133 }
148 ``` 134 ```
149 135 - It assumes at least one process to be RUNNABLE.
150 - It assumes at least one process is RUNNABLE
151 136
152 - It may allow no highest priority process. 137 - It may allow no highest priority process.
153 138
154 - The correctness of the function is *important*. 139 - The correctness of the function is *important*.
155 140
156 ## Docker Limitation 141 ## Docker Limitation
157 142
158 - If repository breaks, Docker poses a problem (a cloud probelm)
159 143
160 - Clound should be used conviniently but don't rely on it. 144 - If repository breaks, Docker poses a problem (a cloud problem).
145
146 - Cloud may be used conveniently but we must not rely on it.
161 147
162 - We can use a direct environment without Docker, since we have a Linux server. 148 - We can use a direct environment without Docker, since we have a Linux server.
163 149
164 - Docker images can easily eats up our disk spaces. 150 - Docker images can easily eat up our disk spaces.
165 151
166 in ~/.zsh_history 152 in ~/.zsh_history
167 153
168 ```c 154 ```c
169 : 1561014922:0;docker system prune 155 : 1561014922:0;docker system prune
171 : 1561015350:0;docker image prune 157 : 1561015350:0;docker image prune
172 : 1561015362:0;docker volume prune 158 : 1561015362:0;docker volume prune
173 ``` 159 ```
174 # Conclusion 160 # Conclusion
175 161
176 - Docker environment poses some problems, some of which are difficult to comprehend
177 162
178 - Storage is difficult too 163 - Docker environment poses some problems, some of which are difficult to comprehend.
179 164
180 - Yet, it gives a good insight of the underlying important concepts of operating system beacuse it is well documented, fast and uses less resources 165
166
167 - Yet, it gives a good insight of the underlying important concepts of operating system because it is well documented, fast and uses less resources.