Spiderman and Hiphop

In this part, you need to discuss in detail the three following topics:

  1. File management
  2. Memory management
  3. Threads or Task/Process Scheduling (you can select either topic)

You must discuss each topic in terms of concepts, issues, solutions, usage, real work examples, etc.

 

In the implementation part, you must implement the pervious discussed topics in Java:

  1. File management
  2. Memory management
  3. Threads or Task/Process Scheduling (you can select either topic)

Note:

You must screenshot and illustrate your results for each part/topic. You also must submit your Java codes on the Blackboard.

Topic 1 – File Management:

You are given a text file “namesList,” which contains a list of names. You need to read the file, store the names in a list, and then count the number of each name (Ahmed   Ali, and Muhammad). Next, you need to create a new text file using Java, order the names alphabetically, and print the name to the new created file named “newNameList.”

Hint 1:

You can read the file using Java built-in classes (e.g., BufferedReader class, Scanner class. File Reader class). To read the file, you must do the following

  1. Create a new function named “readFile.” Inside the function, you must write your code. Here is an example to create a list:

 

List<String> list = new ArrayList<>();

 

  1. Once you stored the data on the list, you now can print/show the list’s data using a Java Foor Loop.

for(int i = 0; i < 5; i++){         System.out.println(i);}

 

Topic 2 – Memory Management:

As memory in any operating system is a scarce resource (limited capacity), programmers must be able to write a code that uses the memory efficiently to improve application performance. In this topic, you must illustrate the following:

  1. Write bad codes that will use the memory inefficiently, which will result in bad performance (e.g., creating unnecessary objects, lists, etc.). Give at least 5 bad examples.
  2. Write good codes that will use the memory efficiently, which will result in optimal performance. In here, you can fix the bad codes you created.

 

There are many memories monitoring tools that you can use to view and visualize memory and CPU utilization (e.g., VisualVM). Use a tool of your choice to show memory usage statistics you obtain from running/executing your bad and good codes.

 

The following tutorial might be very helpful:

https://www.youtube.com/watch?v=pRwvx4QpUfo

https://www.youtube.com/watch?v=AHLkbqcVLvY&t=404s

 

 

Topic/question 3: Threads or Task Scheduling

In this topic, you can choose to implement either thread techniques or task scheduling. Note, we discussed threads and process scheduling in slides week 3 & 4.

 

Threads (choice 1):

Threads can be used to make your Java applications faster. They allow you to run multiple things at the same time. You must think of a good scenario for using threads in real-world, and then implement the scenario in Java. You must discuss your scenario. To create a thread in Java, you can either:

  1. Extend Thread class, or
  2. Implement the Runnable interface

 

You can follow the below steps to create threads:

  1. Create a class named MultiThreads. Inside the class, write your thread logic (variables, functions, etc.). You must create a thread ID for each thread.
  2. Now in the main class, create three threads and illustrate the difference between using one thread and three threads (screenshots and discuss your results).
  3. You need to show a case where two threads run in parallel, where each thread tries to modify a common variable at the same time (screenshots and illustrate your results). Next, try to find a way to fix this issue so that the two threads do not modify the common variable at the same time.

 

Task Scheduling (choice 2):

A single-core CPU executes its processes/tasks one by one based on a given scheduling criteria. Let us say that we have more than one task to be executed. We learned that for any task to be executed, it must be put into a Ready queue. The CPU must choose which task to execute first. As such, you are asked to code two task scheduling algorithms. The first algorithm is First come first serve (FCFS). You must screenshot and illustrate your results. The second algorithm would be either:

  1. Shorter Job First (SJF).
  2. Round Robin.

Choose one from the two above algorithms (1 or 2). For simulating/creating tasks, you can use a factorial function or a Fibonacci sequence function. You can follow the below steps to do the ask scheduling:

  1. Create a new class named “TaskScheduling” and place the function of your choice inside as a method/function.
  2. In the main class (the class you use to run the code), create two objects of your class where each object would run the same method (factorial/ Fibonacci) at the same time. Note: the objects would be assumed as tasks.
  3. You might use system time provided by Java libraries to keep track of time for each task (running time, waiting time, etc.). You can also use this time to properly implement SJF and Round Robin. To obtain the time in java, you can import “time.LocalDate.
  4. Demonstrate your scheduling algorithms using the two objects/tasks. You need to show your results (e.g., running time for each task, waiting time, etc.).
  5. Hint: A queue can be implemented in java using

 

 

You will present your project in class. You must create PowerPoint slides that summarize your work. For each group, all student members must present part of the work.

 

 

 

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more