CS342 Homework 1 solution


Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment


5/5 - (1 vote)

1) Install the following Linux distribution and release into a virtual machine (VM):
Ubuntu Desktop 64-bit 16.04.01 LTS. It is essential that you install this distribution
and release so that you will not have problems like “was working on my machine”.
For this you need to first install a virtual machine monitor software, VirtualBox or
VMware, to your PC or Laptop. VirtualBox is free to use. VMware player is also free
to use. If you have, you can also use VMware Fusion or VMware workstation. You
are highly recommended to use a virtual machine so that a system crash will not affect
you dramatically. After installing Linux on a VM, start Linux and learn basic Linux
usage. You can help each other in installing Linux. Write your experience briefly in
your report.
2) Find out and write down where the kernel executable is in the machine you
installed Linux. Find out the version of your running kernel by using the “uname -r”
command. Write the version number in your report.
3) Download the source code of the Linux kernel (from kernel.org, for example).
Download the version 4.4.1. This is the version that is very close to the version of the
generic kernel of Ubuntu release 16.04. Change into the root directory of the source
code tree and write the names of the subdirectories you see there in your report.
4) Learn C Programming [1][2]. Write a C program “btree.c” that is implementing
binary search tree and will use that to sort words. It will read words (one word per
line) from an input ascii text file and insert them to the binary search tree and then
will write them out to an output text file will in sorted order. This is just to practice
with C.
Write a Makefile to compile your program, so that by just typing “make” the
program is compiled and an executable file called “btree” is generated.
This is useful for you to warm up with C. Make sure you do it alone.
Otherwise it will be very difficult to do the projects. Make sure you develop your
code in C and Linux. You can use the gcc compiler.
Include the source code of your program and sample input/output in your
5) Use the strace command of Linux to trace the systems calls made by some simple
programs like “cp”, “btree”, etc. Use the manual page of strace to learn more about it.
Type “man strace”. Include sample output in your report.
Submission: Submit a pdf file as your report which will include the information
required in each question above. Submit also your btree.c file and your Makefile.
Hence you will submit 3 files: report.pdf, btree.c and Makefile. You will put these
files into a directory named as your Student Id and tar and gzip the directory. For
example a student with ID 21404312 will create a directory named “21404312” and
will put his files into there. Then he will tar the directory (package the directory) as
follows: tar cvf 21404312.tar 21404312. Then he will gzip the tar file as follows: gzip
21404312.tar. In this way he will obtain a file called 21404312.tar.gz. Then he will
upload this file in Moodle. Late submission will not be accepted (no exception). A
late submission will get 0 automatically (you will not be able to argue it). Make sure
you make a submission one day before the deadline. You can then overwrite it.
[1]. The C Programming Language. B. Kernighan and D. Ritchie. Second Edition.
Prentice Hall. 1998. A must have book; very useful.
[2]. Any Book on C, available in Meteksan Bookstore.