# CS 550 Homework 1 1. Setup VM, Linux, and basic testing – must take screen shots at each step to receive points a. Read Oracle VirtualBox White Paper b. Download Oracle VirtualBox 6.0.4 ![](https://i.imgur.com/6Fyq87t.png) c. Install VirtualBox ![](https://i.imgur.com/aF7JRDV.png) ![](https://i.imgur.com/IU3PI0A.jpg) d. Download Ubuntu 18.04.1 Linux ISO image ![](https://i.imgur.com/TNusgpr.png) e. Create Virtual Machine (VM), to support Linux, Ubuntu, 64-bit, 4GB RAM, Virtual Disk 25GB, VDI image, dynamically allocated, 2-core, and a network interface (1GbE or WiFi) with Bridged Adapter ![](https://i.imgur.com/8QkVTBx.png) ![](https://i.imgur.com/lW5chut.png) ![](https://i.imgur.com/dvwTvaE.png) ![](https://i.imgur.com/VTE7jfz.png) ![](https://i.imgur.com/LiTdiq5.png) ![](https://i.imgur.com/Q44Pysm.png) f. Install Linux from the ISO image ![](https://i.imgur.com/7xfg6yw.png) g. Create a user id and password ![](https://i.imgur.com/gT88cUV.png) h. Turn on Firewall and block all ports i. Enable SSH access to your new Linux installation; open SSH port in firewall ![](https://i.imgur.com/K0kV7PY.png) ![](https://i.imgur.com/3d66hC7.png) j. Repeat steps 5 through 9, and create another VM with the same specifications as the first one k. Create private/public keys and install them properly in both of your new VMs ![](https://i.imgur.com/Jo1JdI0.png) ![](https://i.imgur.com/sg8Z9iI.png) l. Test that you can connect remotely to your VMs with your keys, from one VM to the other VM ![](https://i.imgur.com/xRgvgB7.png) ![](https://i.imgur.com/9lGdOou.png) 2.Show an example of using the following commands (hint: you can use man to find more information about each one); take screen shots of your commands; make sure to clear the screen between each command; explain in your own words what these commands do: a. ssh ![](https://i.imgur.com/8Ehs5DR.png) ssh command enable users to connect and to run remotely a computer resource which supports ssh connection. The computer resource could be a physical machine and a virtual machine instance. b. ssh-keygen ![](https://i.imgur.com/QtbDk4h.png) It creates authentication key for ssh-ing. It creates the public/private key which may vary depending on a given key-format. c. scp ![](https://i.imgur.com/SOLpFhg.png) scp command gives the capability to transfer data(file(s), directory(ies)) from a host/remote machine to another host/remote machine d. history ![](https://i.imgur.com/2weM7s5.png) history command shows the log of previous commands. grep, tail or head commands can improve flexibility to pick specific logs. e. sudo ![](https://i.imgur.com/YpKLPEZ.png) sudo, which stands for `superuserdo` , gives the permission which the root user has to other users who are not the root user. It can resolve `permission denied` issue. In addition, `sudo -i` changes user to the super user. f. ip ip command has many options we can do. Basically, it can query IP addresses, the state of all network interface, the routing table and all that. - ip addr![](https://i.imgur.com/0wp1F8x.png) - shows all addresses information - ip link![](https://i.imgur.com/pfUNChj.png) - shows the state of all network interfaces - ip route![](https://i.imgur.com/CbwfYi7.png) - shows the routing table Additionally, it can add/delete an address or an entry into the routing table - ip addr add|del `ip/port` `device` `name` - add|del `ip` and `port` to device `name` - ip route add|del `ip1` via `ip2` g. touch It literally touches a specific file to update timestamps on the metadata. If the file doesn't exist, it generates the file. h. ls ![](https://i.imgur.com/u25EZQg.png) It shows files of the current directory where `ls` specifies. ls can have the path as a parameter so that ls is executed in that path. i. mkdir ![](https://i.imgur.com/REsuKFt.png) mkdir stands for `make directory`. It literally generates new directory j. cd cd stands for `change directory`. It enables user to navigate the filesystem. k. dd ![](https://i.imgur.com/eMvgwKi.png) dd is generally used to transfer(copy) `bs*count` bytes data from `if(input file)` to `of(output file)`. It is quitely useful to do benchmark filesystems or hardware performance(usb, ssd, hdd and all that) because it summerizes the data speed in the end. l. fdisk m. apt It is the package manager of Debian-based Operating System such as Ubuntu, Debian, Arch Linux...) other distros uses dnf/yum etc.. n. vi ![](https://i.imgur.com/TvZMQtL.png) vi is one of famous text editors so that user can edit files in shell environment. o. time ![](https://i.imgur.com/m4oDYRd.png) time measures the execution time of user/system spaces in sec unit. p. tar ![](https://i.imgur.com/R5dmjfT.png) It enables the user to create/extract a variety of compressed file(zip, rar,...), taped file(tar). When tar is created, it does not compress files but it does tape files q. rm ![](https://i.imgur.com/AZ9GANZ.png) It removes a given file. r. cat ![](https://i.imgur.com/FNUXegb.png) It reads file and writes the contents of file to a monitor(standard output) s. bash ![](https://i.imgur.com/j1jF46B.png) Nowadays, bash is mostly installed as default shell program. it changes your shell to bash t. more ![](https://i.imgur.com/IPP6aDV.png) u. watch ![](https://i.imgur.com/eo90NIJ.png) It watches how a target program changes its output every given time.![] v. ps ![](https://i.imgur.com/fAdihns.png) It shows the user running processes with a little information, such as name, process id when it is called. It does not change information dynamically. w. top ![](https://i.imgur.com/jVhjoxu.png) It shows the dynamic process information more than ps command. Additionally, it has the usage of memory, cpu and all that. x. htop ![](https://i.imgur.com/NudWnga.png) The advanced version of top command. For someone who doesn't have htop, should download it. It supports interactive ways to the user. y. gcc ![](https://i.imgur.com/HWg6C8y.png) gcc is a compiler for C and C++. We can compile source codes into an executable file, object files, assembly files as well. z. tail ![](https://i.imgur.com/TJZ5OyW.png) It only shows the last n items. n is the number of lines from the end. ex tail -5 foo.txt aa. grep ![](https://i.imgur.com/tUmBcic.png) It is super useful to find some text pattern from the given data which could be a text file, directory(ls) and so on. bb. kill ![](https://i.imgur.com/6dbQGf0.png) It sends signal to the specific process id. The type of signal can be specified with number and some captial English. cc. killall ![](https://i.imgur.com/HyBwZ5F.png) It sends signal to specific process id or name. Nice thing of this command is that we can send to all matched processes. ee. df ![](https://i.imgur.com/94KaO7K.png) This command details the amount of disk space availible on the file system where the file arguement is stored. ff. screen ![](https://i.imgur.com/tIfx1Bp.png) Screen lets you create sessions that will continue to run even if your SSH connection is dropped. You can then reconnecta nd reattach to the sessions you have created and they will be running as if you never got disconnected to the machine. gg. vim ![](https://i.imgur.com/O5EDGju.png) Vim is an in-terminal text editor. Its fast,lightweight, and has lots of plugins. Great for system programming. hh. chmod ![](https://i.imgur.com/VhEDwsR.png) This is for changing the permissions on a file for users,group,others. ii. chown ![](https://i.imgur.com/dPRiTWN.png) this is for changing the file ownership. changing the ownership of the file will give a new user/group the owner file permissions. jj. useradd ![](https://i.imgur.com/M3VU32n.png) this is how to create a new user/ edit current user info. kk. mv ![](https://i.imgur.com/v98tLxk.png) this moves a file,directory from current location to the targetlocation ll. man ![](https://i.imgur.com/ECI1suP.png) This shows the manual entry for the command specified. mm. locate ![](https://i.imgur.com/dLsUnhv.png) this prints to the console the location of the files specified, regex may be used for finding files based on patterns. nn. find ![](https://i.imgur.com/T1jp7PW.png) this prints files/directories in the directory tree that fit the expression. for example using the -cnewer [file] option, find will return files that were modified afterthe specified file. oo. sed ![](https://i.imgur.com/aVTDEkd.png) this is a streaming text editor. it makes one pass over the file entered and performs changes based on the specified arguments. pp. awk ![](https://i.imgur.com/eHzu2fy.png) this is a language that is particularly good for parsing, and text processing. the language is written as a number of pattern-action lines. qq. diff ![](https://i.imgur.com/AZVKkzm.png) This commands prints out the lines of two filles that are different. rr. sort ![](https://i.imgur.com/VNKVc8x.png) this sorts the target file based on the options selected. if none, then the file is sorted alphebetically ss. export ![](https://i.imgur.com/1bG3gqp.png) this specifies variables and functions that will be passed to child processes and thus accesible from them. tt. pwd ![](https://i.imgur.com/cngTfDv.png) print working directory. This prints the path of the current directory uu. crontab ![](https://i.imgur.com/Y7XV3l9.png) crontab lets you modify and schedule tasks which are run by the cron daemon. such tasks may include routine system backups, etc. vv. mount ![](https://i.imgur.com/4DkL1VD.png) this makes a storage device, filesystem accesible to an existing directory ww. passwd ![](https://i.imgur.com/Cmz0Pnr.png) this is used to change the password of a user xx. uname ![](https://i.imgur.com/Ium4cU7.png) this prints system details yy. whereis ![](https://i.imgur.com/FFXRTBb.png) this locates the source files for the files/programs specified aaa. less ![](https://i.imgur.com/Sn8oH1h.png) similar to more, but including more features, it does not read all of the text before showing it so it can open large files very fast. bbb. su ![](https://i.imgur.com/lMTjtYn.png) This is to change users during a session. ccc. ping ![](https://i.imgur.com/8DQevYH.png) This sends an ICMP echo request to the specified host ddd. traceroute ![](https://i.imgur.com/eFh25V5.png) This shows the route that packets are taking from the host machine to a target machine eee. date ![](https://i.imgur.com/ycLjibF.png) prints the date fff. time ![](https://i.imgur.com/vGZCnKY.png) this runs the program specified and prints out time related information about the execution time of the program ggg. wget ![](https://i.imgur.com/Q2xB9M7.png) this allows the user to download files from other machines on a network. it is non-interactive, so the user can detach and it will continue hhh. wc ![](https://i.imgur.com/zwn6ja9.png) this prints word count, line count, and byte count of the specified file iii. clear ![](https://i.imgur.com/5G3oaC0.png) this clears the text on the terminal jjj. exit this is one way you terminate the terminal process. I cannot screen shot this, because as soon as you enter it the terminal window closes. 3. a.in order to run this in a manner in which you can close your session and the task will not be interupted, you can use the screen command to create a new session. then run the command and detach from the session. Now you can close the session you are in and the benchmark script will continue to run. 4. Answer the following questions about VMs: a. In the system configuration of the VM, explain how changing the number of processors changes the behavior of your VM. Explain a scenario where you want to set this to the minimum, and a scenario where you want to set it to the maximum. Why is setting it to the maximum potentially a bad idea? Answer a : Chaning the number of processors allows guestOS's to see more virtual CPUs to find idle resources instead of physically assigning. The reason setting to the maximum is that both a guest OS and the hypervisor both produce negative performance because while the guest OS uses all CPU resources, the hypervisor is unable to allocate enough resource to complete its tasks(mostly background jobs). Namely, CPU ready wait time goes up. b. In the system configuration of the VM, under the Acceleration Tab, explain the difference between the paravirtualization options: None, Legacy, Minimal, Hyper-V, and KVM. Explain which one would be best to use with Ubuntu Linux, and why. Answer b : The Oracle VirtualBox documentation provides the explanation of those interfaces. Since all operating systems released out have different instructions to execute their jobs depending on operating system version, different types of kernel, and different kernel version as well, it is necessary to notify the environment of the host operating system to a guest operating system in order to appropriately leverage performance by knowing the fact that which instructions can be virtualized or not. These paravirtualization interfaces provide the information, the guest OS should know to have the benefit of virtualization, to the guest OS. * Minimal : "is mandatory for running guest Mac OS X" * KVM : "is recommended for Linux Guests" * Hyper-V : "is recommend for Windows Guests" * None: It literally disables paravirtualization * Legacy : Legacy option is for a old virtual machine which was created by old hypervisor. Since interface may vary, it will use the newer version of paravirtualization interfaces. For Ubuntu Linux, KVM would be the best option for paravirtualization interface. The reason is that Ubuntu has Linux kernel and Linux kernel has KVM as a virtualization module so KVM can be considred as the native instruction sets at Ubuntu. Thus to leverage paravirtualization, KVM would be the best option. c. In storage devices when configuring the VM, there are multiple types of storage controllers: explain the difference between the IDE, SATA, and NVMe controller. Give an example for each type of storage controller of a scenario where you may want to use this type of controller. First of all, these are the generation of storage device controllers. The IDE cable is designed to port a hard disk or a cd-rom(optical disk). Unlike SATA, an IDE cable needs to connect two lines for devices and one for a motherboard. Additionally, SATA is quietly faster than IDE in terms of data transmission. Also, an IDE doesn't support SSD but SATA does. NVMe is the advanced and newest cable among these three cables. It is designed to connect a non-volatile device, mostly SSD device. Although SATA supports SSD, SATA was developed to support HDD. Thus, the compability and reliability issues exist. d. In the network configuration of the VM, there are multiple types of network adapters: explain the difference between NAT, Bridged Adapter, Internal Network, and Host-only Network. Give an example for each type of network of a scenario where you may want to use this type of network. Host-only Network literally allows to have one IP which is only available to communicate with the host machine. Whereas, NAT and Bridged Adapter can have IP which can access to external network as if the host does. However, NAT doesn't allow external network to access to the VM directly but Bridged Adapter does. e. For the USB configuration of the VM, explain the difference between USB 1.1, 2.0, and 3.0 controllers. USB 1.1 is universally supported throughout every virtual machines regardless of the version of a virtual machine monitor because a keyboard and a mouse use it. USB 2.0 and USB 3.0 have something in common for the sake of usability. If you matter the speed for your device, USB 3.0 will be the best choice among three because its maximum bandwidth is 4.8 Gbps 5. (12 points) Answer the following questions about computer processors: a. Today's commodity processors have 1 to 32 cores, with some more exotic processors boasting 72-cores, and specialized GPUs having 5000+ CUDA-cores. About how many cores/threads are expected to be in future commodity processors in the next five years? I would look forward to having 128cores/256 threads. Since there is a 64 cores/128threads out, this number can quietly be expected. b. Describe what a core and hardware thread is on a modern processor, and the difference between them? * A core is the physical part of a cpu which works on computing * Hardware thread is the part of a core that handle computing. c. Compare GPU and CPU chips in terms of their strength and weakness. In particular, discuss the tradeoffs between power efficiency, programmability and performance. * In terms of power efficiency, programmability and performance, if GPU decided to run O/s, it would have horrible time because GPU is not designed for it. Since gpu is designed for large data set of simple computing and cpu is designed for many sequantial tasks(a small data set of complex computing). Also GPU could have bad performance if parallel program is poorly written, which means that it doesn't fully exploit its resource. d. Why do we not have processors running at 100GHz today (as might have been predicted in the year 2000)? high temperature is the main reason why we do not have such processors. 6. (12 points) Answer the following questions about threading: a. Why is threading useful on a single-core processor? Without threading on a single-core processor, the world would have became waiting-world. Namely, It gives us multi-tasking capability at one time by providing pipelining threads efficiently. b. Do more threads always mean better performance? It doesn't guarantee because the more you have threads, the often you need to communicate relative threads to complete one task. If communication among threads often, it would cause the overhead because communication ends up completing sequentially. c. Is super-linear speedup possible? Explain why or why not. Because of Amdahl's Law, it does not seems possible. The graph ends up stopping the speed up at a certain point. d. Why are locks needed in a multi-threaded program? The reason a multi-threaded need locks is obvious because threads essentially have shared-memory region, which all threads can access to fetch some data. While one thread is handling some data which resides in this shared-memory region, there is high possibility that another thread is going to fetch that data and overwrite other value on it. If a scheduler lets the first thread do a rest of its tasks, the thread can have value-conflict. To avoid this non-deterministic situation, locking is mandatory. e. Would it make sense to limit the number of threads in a server process? Yes. No limitation of the number of threads will cause Out-of-memory problem.