Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Study and understand how the fetchall program from the reference Reference below. Execute it for the following top 10 search engines (you will pass them

image text in transcribed

Study and understand how the fetchall program from the reference Reference below. image text in transcribed

image text in transcribed

Execute it for the following top 10 search engines (you will pass them all to the program at the same time as command-line arguments) and report their parallel and individual fetch times in a bar graph: Google, Bing, Yahoo, Baidu, Yandex, DuckDuckGo, Ask.com, Ecosia, Aol.com, Internet Archive Make sure that you repeated the above experiment 10 times and averaged the results before reporting them. Next, modify the fetchall program so that it runs sequentially. For this task, you will initially need to remove the go keyword in line 17; however, this will cause the program to hang. Explain why it hangs, fix the hanging issue, and report how you fixed it. Share your modified code for the sequential version and report again in another bar graph the sequential fetch time together with the individual ones. Report the speed-up (sequential fetch time divided by the parallel fetch time), and let us know which search engine is fetched the fastest in your tests! 1.6 Fetching URLs Concurrently One of the most interesting and novel aspects of G0 is its support for concurrent programming. This is a large topic, to which Chapter 8 and Chapter 9 are devoted, so for now we'll give you just a taste of Go's main concurrency mechanisms, goroutines and channels. The next program, fetchall, does the same fetch of a URL's contents as the previous example, but it fetches many URLs, all concurrently, so that the process will take no longer than the longest fetch rather than the sum of all the fetch times. This version of fetchall discards the responses but reports the size and elapsed time for each one: gopl.io/ch1/fetchall I/ Fetchall fetches URLs in parallel and reports their times and sizes. package main import ( "fmt" "io" "io/ioutil" "net/http" "os" "time" ) func main() \{ start := time.Now() ch := make(chan string) for, , url := range os.Args[1:] \{ \}o fetch(url, ch) // start a goroutine for range os.Args[1:] \{ fmt.Println(

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 22nd International Conference Dexa 2011 Toulouse France August/September 2011 Proceedings Part 1 Lncs 6860

Authors: Abdelkader Hameurlain ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2011th Edition

3642230873, 978-3642230875

More Books

Students also viewed these Databases questions

Question

c. What were the reasons for their move? Did they come voluntarily?

Answered: 1 week ago

Question

5. How do economic situations affect intergroup relations?

Answered: 1 week ago