Which of the given display process state dynamically

Assignment Help DOT NET Programming
Reference no: EM131395615

Assignment

Part I:

1. The following is the C# sample code that shows two threads use mutex to communicate. Note mutex is a simplified semaphore.

Refer to this piece of sample code, write a program that conduct the followings:

(1) It contains two thread, t1 and t2;
(2) t1 and t2 share a variable, myNum;
(3) When myNum is empty (use 0 to show empty), t1 will generate a random number between 1 and 99, and save to myNum;
(4) When myNum is not empty, t2 will get this number and save it to an array, myNumArray, in ascending order.
(5) After t2 insert a new number in myNumArray, it also shows the result on screen.

// mutex sample code
using System;
using System.Collections.Generic; using System.Linq;
using System.Text; using System.Threading;

class Test
{
// Create a new Mutex. The creating thread owns the
// Mutex.
private static Mutex mut = new Mutex(true); private const int numIterations = 1; private const int numThreads = 2;

static void Main()
{
// Create the threads that will use the protected resource. for (int i = 0; i < numThreads; i++)
{
Thread myThread = new Thread(new ThreadStart(MyThreadProc)); myThread.Name = String.Format("Thread{0}", i + 1); myThread.Start();
}

// Wait one second before allowing other threads to
// acquire the Mutex.
Console.WriteLine("Creating thread owns the Mutex."); Thread.Sleep(1000);

Console.WriteLine("Creating thread releases the Mutex.\r\n"); mut.ReleaseMutex();

//Console.ReadKey();

}

private static void MyThreadProc()
{
for (int i = 0; i < numIterations; i++)
{
UseResource();
}
}

// This method represents a resource that must be synchronized
// so that only one thread at a time can enter. private static void UseResource()
{
// Wait until it is safe to enter. mut.WaitOne();

Console.WriteLine("{0} has entered the protected area", Thread.CurrentThread.Name);

// Place code to access non-reentrant resources here.

// do work here!! Thread.Sleep(500);

Console.WriteLine("{0} is leaving the protected area\r\n", Thread.CurrentThread.Name);

// Release the Mutex. mut.ReleaseMutex();
}
}

Part II: Login to Linux (Hyper-v Virtural machine), study Linux and following the following questions.

1. Which of these is a UNIX command which will list the contents of a directory?

A. pwd
B. ls
C. list
D. files
E. directory

2. To make a new directory, you would use which command?

A. directory
B. create
C. make
D. mkdir
E. dirmk

3. To remove a directory, you would use which command?

A. remove
B. erase
C. delete
D. deldir
E. rmdir

4. The command which terminate a process is called:

A. copy
B. file
C. filecopy
D. cp
E. kill

5. Partial output of ls -F command is: Work1*
Work2/

Which of the following is correct?

A. Work2 is executable, Work1 is a directory
B. Both are executable
C. Work1* and Work2/ are two files
D. Work1 is executable, Work2 is a directory
E. None of above

6. To check the process status, which command you would use:

A. ps
B. left
C. cat
D. quotas
E. disk

7. The command, makedir, will create a sub-directory. True or false?

A. True
B. False

8. is the command that changes the file permission.

A. pr
B. top
C. chmod
D. head

10. The command will display the absolute pathname for the directory that you are wokring in.

A. dir
B. whereami
C. pwd
D. ls

11. In Fedora 20, a regular user, john, wants to become root user and do some administration tasks. Which of the following should he use?

A. root
B. super
C. admin
D. su root

12. In Fedora 20, which of the following display process state dynamically?

A. ps
B. top
C. more
D. cat

13. In Fedora 20, a regular user, john, wants to check whether a program, DemoApp, is running or not. Which of the following should he use?

A. find DemoApp
B. whereis DemoApp
C. man DemoApp
D. ps -ax

14. In Fedora 20, a regular user, john, wants to check the options for ps command. He type man ps

Which of the following will terminate man command?

A. c
B. q
C. x
D. z

Reference no: EM131395615

Questions Cloud

Define a class star : Define a class Star. One parameter should be the number of points. Draw a few stars with differing numbers of points, differing line colors, and differing fill colors.
Describe the role that the brain plays : Explain the two types of conditioned learning processes and then apply operant conditioning techniques to show how a teacher could use them in the classroom to ensure students were behaving appropriately. Define altruism and empathy and describe th..
Monopolistic competition and monopoly market structures : 1. What barriers to entry exist for the Monopolistic competition business model? 2. Describe the difference between Monopolistic Competition and Monopoly market structures.
Define a class poly that represents a polygon : Define a class Poly that represents a polygon but checks that its points really do make a polygon in its constructor. Hint: You'll have to supply the points to the constructor.
Which of the given display process state dynamically : COMP4100- In Fedora 20, which of the following display process state dynamically? In Fedora 20, a regular user, john, wants to check the options for ps command. He type man ps. Which of the following will terminate man command?
Draw fbds for each basic element and find equation of motion : The input to the system is the engine torque r that is transmitted to the wheel m, . The uniform wheel is connected to the car body mass m2 through a spring with a stiffness of K, which represents the flexibility of the support structure of the c..
Define two classes smiley and frowny : Define two classes Smiley and Frowny, which are both derived from class Circle and have two eyes and a mouth. Next, derive classes from Smiley and Frowny which add an appropriate hat to each.
What is the maximum amount of soda : Place soda on the vertical axis and biscuits on the horizontal. Use this to answer questions. A) What is the maximum amount of soda and biscuits Denmark can produce? ($1,000)
What other factors could account for the relationship : Is the second statement justified by the first? What other factors could account for the relationship? What non-experimental investigation might illuminate the role(s) of those other factors

Reviews

Write a Review

DOT NET Programming Questions & Answers

  Task design and implement tower of hanoi puzzle program

task design and implement tower of hanoi puzzle program using c and windows presentation foundation wpf template in

  How will you retrieve environment variables in c sharp

Question: How will you retrieve environment variables in C#.net?

  Demonstrate academic and professional literacy

Demonstrate academic and professional literacy by collating theoretical and practical course material into a workable application through understanding concepts and their practical application using .NET

  Analyze the time complexity of implementation

Analyze the time complexity of your implementation using O-notation. Note that the time complexity also depends on the data structures you used in the implementation.

  Create a c# program that includes a coffeeorder class

Create a program that includes the following requirements: Create a CoffeeOrder class

  Write a c# program that declares variables

Write a C# program that declares variables to represent the length and width of a room in feet. Assign appropriate values to the variables

  Create web application to be used as a loan calculator

Create an ASP.NET web application to be used as a loan calculator. The textboxes used to input data (loan amount, repayment period in months, and interest rate) should be checked for valid entries

  Give their telephone numbers using one or more letters

People sometimes give their telephone numbers using one or more letters. write a program that accespts a 10 digit telephone number that may contain one or more letters. display the corresponding number using numerlas. the numbers and letters are a..

  Write a program in c# that creates a professorrating class

Write a program in C# that creates a ProfessorRating class consisting of professor ID and three ratings. The three ratings are used to evaluate easiness, helpfulness, and clarity.

  Html coding

Write a two- to four-page paper describing how you would change or enhance your site if you "knew then what you know now". Be sure to include interaction with Spry Validation Text Field, Spry Collapsible Panel widget, and Adobe widgets in your new..

  Write a c# program to store an array of integers

Write a C# program to store an array of integers 10 through 19. Use an appropriate loop to multiply all of the values in the list. Print out the result.

  Assignment related to online role-playing games

Construct evaluation techniques to the user experience and system usability in the design process. Describe the differences in developing user interfaces for different application environments.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd