Running head: EXPALANATORY TOPIC RESPONSES

2

EXPALANATORY TOPIC RESPONSES

EXPALANATORY TOPIC RESPONSES

Name:

Institution:

Course:

Instructor’s Name:

Date:

A SUMMARY OF WHAT I HAVE LEARNT.

Panda is a mammal that forms one of the largest mammals in the world which live in the forests and feed on bamboos. They do vary in colours and these colours dictate their territories. They have well developed body to adapt to the environments they live in and spend most of its time looking for food which they consume at a very high rate of about 10000 kilograms of bamboos which is their main food. They are becoming extinct as result of human activity as well as consumption rate.

KEY WORDS RELATED TO MY TOPIC

Feeding habit

Adaptation

Extinction

Mammals

Inhabitant

Lifecycle

SUBJECTS RELATED TO MY TOPIC

Endangered species of the animals in the world

Environmental pollution in relation to the wildlife

Policies and laws to protect the wildlife

RESEARCH QUESTION

Analysis of the human action effects to the wildlife future and their life today.

THESIS STATEMENT OF THE RESEARCH PAPER

The human action based on various matters affect both the life of the wildlife as well as their future existence.

REFERENCE

Baek, M. (2009). Panda & polar bear. New York: Dial Books for Young Readers.

Eason, S., Geeson, A., & Veldhoven, M. (2009). Save the panda. New York: Power Kids Press

Entwistle, A., & Dunstone, N. (2000). Priorities for the conservation of mammalian diversity. Cambridge, U.K.: Cambridge University Press.

Goals:

1. To gain hands-on experience with fork(), exec(), and wait() system calls.

2. To master the basics of multi-process application development.

3. To appreciate the performance and fault-tolerance bene_ts of multi-process applications.

4. To implement a multi-process downloader application.

Overview

File downloaders are programs used for downloading _les from the Internet. In this assignment

you will implement two different types of multi-process downloaders (i.e., _le downloaders that

comprise multiple processes):

1. a serial _le downloader which downloads _les one by one.

2. a parallel _le downloader which dowloads multiple _les in parallel.

You will then compare the performance of the two types of downloaders.

Both downloaders will use the Linux wget program in order to perform the actual downloading.

The usage of the wget is simple: wget <FILE URL>. For example, running from command line

the following command:

wget http://releases.ubuntu.com/15.04/ubuntu-15.04-desktop-amd64.iso

will download the Ubuntu Linux iso image to the current directory. Before proceeding with the

assignment, you may want to take a moment to experiment with the wget command.

In your program, the parent process shall _rst read the _le, urls.txt, containing the URLs of

the _les to be downloaded. urls.txt shall have the following format:

<URL1>

<URL2>

.

.

.

For example:

http://releases.ubuntu.com/15.04/ubuntu-15.04-desktop-amd64.iso

http://releases.ubuntu.com/14.10/ubuntu-14.10-server-i386.iso

Next, the parent process shall fork the child processes. Each created child process shall use the

execlp() system call to replace its executable image with that of the wget program. The two

types downloaders are described in detail below.

The two downloaders shall be implemented as separate programs. The serial downloader

program shall be called serial.c (or .cpp extension if you use C++). The parallel downloader

program shall be called parallel.c (or .cpp extension if you use C++).

Serial Downloader

The serial downloader shall download _les one by one. After the parent process has read and

parsed the urls.txt _le, it shall proceed as follows:

1. The parent process forks o_ a child process.

2. The child uses execlp("/usr/bin/wget", "wget", <URL STRING1>, NULL) system call

in order to replace its program with wget program that will download the _rst _le in

urls.txt (i.e. the _le at URL <URL STRING1>).

3. The parent executes a wait() system call until the child exits.

4. The parent forks o_ another child process which downloads the next _le speci_ed in

urls.txt.

5. Repeat the above steps until all _les are downloaded.

Parallel Downloader

1. The parent forks o_ n children, where n is the number of URLs in urls.txt.

2. Each child executes execlp("/usr/bin/wget", "wget", <URL STRING>, NULL) system

call where each <URL STRING> is a distinct URL in urls.txt.

3. The parent calls wait() (n times in a row) and waits for all children to terminate.

4. The parent exits.

Please note:

_ While the parallel downloader executes, the outputs from di_erent children may intermin-

gle. This is acceptable.

_ fork.c _le posted on Titanium provides an example of using fork(), execlp(), and

wait() system calls. Please feel free to modify it in order to complete the above tasks.

_ Please make sure to error-check all system calls. This is very important in practice and can

also save you hours of debugging frustration. fork(), execlp(), and wait() will return -1

on error. Hence, you need to always check their return values and terminate your program

if the return value is -1. For example:

p i d t pid = f o r k ( )

i f ( pid < 0)

f

pe r r o r (" f o r k " ) ;

e x i t (􀀀1);

g

The perror() function above will print out fork followed by the explanation of the error.

Performance Comparison

Use the time program to measure the execution time for the two downloaders. For example:

time ./serial

real 0m10.009s

user 0m0.008s

sys 0m0.000s

The column titled real gives the execution time in seconds. Please get the execution times for

both downloaders using the following urls.txt _le:

http://releases.ubuntu.com/15.04/ubuntu-15.04-desktop-amd64.iso

http://releases.ubuntu.com/14.10/ubuntu-14.10-server-i386.iso

Your execution times should be submitted along with your code (see the section titled "Submis-

sion Guidelines".

In your submission, please include the answers to the following questions (you may need to do

some research):

1. In the output of time, what is the di_erence between real, user, and sys times?

2. Which is longer: user time or sys time? Use your knoweldge to explain why.

3. When downloading the _les above, which downloader _nishes faster? Why do you think

that is?

4. Repeat the experiment for 10 _les (any reasonably large-sized _les, e.g., 100 MB, will do).

Is the downloader in the previous question still faster? If not so, why do you think that

is?

Technical Details

The program shall be ran using the following command line:

./multi-search <FILE NAME> <KEY> <NUMBER OF PROCESSES>

Where <FILE NAME> is the name of the _le containing the strings, <NUMBER OF PROCESSES> is

the number of child processes, and <KEY> is the string to search for. For example, ./multi-search

strings.txt abcd 10 tells the program to split the task of searching for string abcd in _le

string.txt amongst 10 child processes.

SUBMISSION GUIDELINES:

_ This assignment MUST be completed using C or C++ on Linux.

_ Please hand in your source code electronically

_ You must make sure that the code compiles and runs correctly.

_ Write a README _le (text _le, do not submit a .doc _le) which contains

Your name and email address.

The programming language you used (i.e. C or C++).

How to execute your program.

The execution times for both downloaders.

The answers to all questions above.

Whether you implemented the extra credit.

Anything special about your submission that we should take note of.

_ Place all your _les under one directory with a unique name (such as p1-[userid] for

assignment 1, e.g. p1-m1).

_ Tar the contents of this directory using the following command. tar cvf [directory name].tar

[directory name] E.g. tar -cvf p1-m1.tar p1-m1/

2

EXPLORATORY ESSAY

Adventure – Extinction of the Panda

A panda is one of the largest mammals that reach almost the size of a black bear (back, 2009). Big and giant pandas have various features that range from the size of their head, feet and tail. In most cases, pandas can grow to achieve a height of between five and six feet and weigh up to two hundred and seventy pounds. The males weigh up to 10 to 20% more than female panda of the same age. Giant pandas can climb trees easily and effortlessly by using their short and strong claws (Stein, 2007).

The panda has a lifespan of twenty-five years and have several enemies including humans. This matter is of interest as the giant panda has been a target of poaching. According to a research in 2006, the number of pandas has greatly declined due to a variety of reasons to an estimated one thousand pandas only. Panda molars are strong and large to help with chewing. The molar have powerful muscles that extend from the head to the jaws. Entwistle & Dunstone (2000) state that the powerful muscles make it easy for the panda to chew even the tough stalks. The panda exists in a variety of colors. Some are white with black eye patches. The panda’s natural habitat is in the deep forests and the higher elevations where there is thick snow from which the color offers camouflage. The color also draws other pandas from each other’s territory.

The issue of poaching is serious as it is contributing to the threat facing pandas’ existence to day. I feel that the issue should be curbed and the relevant authority to take charge of protecting the animals. If this trend is continued, the animals may become extinct in the near future. Pandas are hunted for their soft far. This trend has led to them being endangered species. A panda has a thick course with a dense outer layer that provides protection to the panda from the cool and damp environmental climate. The earliest panda generation was in the ice age duration. The red panda is a close relative of the giant panda that lives in Nepal India. The red panda is relatively small and lives on trees. The red panda mostly eats nuts, fruits and insects. A young red panda is born pink in color but changes colors as it grows.

Averagely, a panda spends 14 hours looking for food. Newborn pandas are tiny and blind and usually weigh about three to four ounces. The young pandas start-off with fine white far and get their normal color after one month (Stein, 2007). A giant panda starts eating bamboo at the age of five to six months and undergoes weaning until they are nine months old.

According to the Chinese culture, a panda symbolizes companionship, peace and friendship. There are various exciting facts about pandas. Back (2009) says that one of these facts is the fact that the pandas can eat up to ten thousand kilograms of bamboo in a day. It is difficult to determine the sex of the panda for the first four years. As mentioned earlier, human activities have led to pandas nearing extinction. Apart from poaching, humans have also encroached in pandas’ habitat by cutting bamboos. The giant panda is the most endangered panda species. Though the giant pandas are adored by many people, the old and the young, it is near extinction and is endangered (Stein, 2007). In my opinion, human beings should stop the activities that are endangering the lives of the pandas. I love pandas and I feel for them because of the state they find themselves in.

There is an alarming disappearance of the giant pandas due to the expansion of human populations. The increasing population shrinks the natural habitat of the pandas making them have nothing to eat (Stein, 2007). The giant pandas in China suffer a low birth rate and invasion of the humans into their natural habitat. The panda meat is one of the favorite meals in China, which explains the reason for the alarming panda extinction. Census often shows that the extinction rate is worsening every coming year (Eason, Geeson & Veldhoven, 2009). I feel concerned about the alarming rate of the pandas because if it is not checked, there will be no pandas in the coming years.

Nations have put in place measures to deal with the alarming extinction of the pandas. For instance, laws that bar human beings from inhabiting panda’s natural habitat have been developed. Other countries carry out captive breeding and take years to capture baby pandas when they are born. Nations are now looking for a supplement to replace bamboo as the major food for the pandas. Countries carry out research of the survival of the pandas to maintain the population of the pandas (Eason, Geeson & Veldhoven, 2009).

In conclusion, measures should be put in place to curb the extinction and provide a better living environment for the pandas. Developing laws on protection of pandas is not enough if there is no goodwill in implementing them. Therefore, while measures have been developed, it is upon the relevant authorities and the public to fulfill these measures. The giant panda still faces challenges, as they cannot live in isolated areas but need large areas where they freely roam, and there is enough food for them. Pandas are great creatures that deserve a serene habitat for their growth. If they are not allowed to live in their natural habitat and there is interference by the humans, their extinction can only become alarming (Stein, 2007). Humans should therefore refrain from encroaching into the natural habitat of the wild to be able to enjoy nature in the world.

References Back, M. (2009). Panda & polar bear. New York: Dial Books for Young Readers. Eason, S. Geeson, A., & Veldhoven, M. (2009). Save the Panda. New York: Power Kids Press. Entwistle, A., & Dunstone, N. (2000). Priorities for the conservation of mamalian diversity. Cambridge: Cambridge University Press. Stein, L. (2007). Eye of th emajestic creature. New York: Fantagraphics.

Get help from top-rated tutors in any subject.

Efficiently complete your homework and academic assignments by getting help from the experts at homeworkarchive.com