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

  Develop web services based application

Develop and test a Web services based application that meets the requirements applying SOA design principles.

  Design style elements in asp

Add drop down lists for modifying the different style elements for the label element that displays the time

  Create a shopping cart in asp

The users will use a browser to access the on-line store. The web server software for the production web server is Windows 2003 Server /IIS6.

  Inventory management system in c# application

Inventory management system in c# application

  Using .net resources to teach .net

This project will use the .NET framework to produce a set of materials to demonstrate the fundamental principles of .NET. Ideally it should demonstrate some of the principles of the framework e.g. interoperability.

  Prepare a marymount faculty site

Prepare a Marymount faculty site

  Blinky lights

Analysis proving that your code blinks the LEDs at the specified rates.

  Prepare a web application

Prepare a web application that will be used to keep track of patients registering in a hospital.

  Implementing the insurance management system

Implementing the Insurance Management System and implementation of Components as Web Services.

  Describe the characteristics of visual studio 2005

Describe the characteristics of Visual Studio 2005 Visual Studio.Net is a suite of products that includes 4 main languages. Name these languages and outline their use in industries

  What is a connectionstring

What is a ConnectionString. Give a suitable example to illustrate the various part of a ConnectionString

  Prepare a web application for internet service provider

Prepare a Web application and write the code also event planning document base. This web application allows the user to sign up for an Internet service provider for home connectivity.

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