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

  Prepare a marymount faculty site

Prepare a Marymount faculty site

  Create an interface that has two list boxes

Create an interface that has 2 list boxes for i) the weekly hours worked (containing integer values from 35 to 45 inclusive) and ii) the hourly rate of pay (from 9.50 to 14.00 inclusive, in increments of 0.50).

  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 Visual Studio 2012 or newer.

  Create a typed dataset

We will create a typed dataset, a Data Layer class, several functions to access the data, and a connection to a database. We also will add a search form to allow the user to search records in the database and display the results of that search

  Write a vbnet windows application to aid in the calculation

Write a VB.NET Windows application to aid in the calculation of reconnect charges for delinquent electric customers. When customers fail to pay their electric bill.

  The data for 10 professional baseball teams for the year

the data for 10 professional baseball teams for the year 2001 is given below. write a c console application that does

  Write a program prompt the user for the appropriate input

Write a program using C#, prompt the user for the appropriate input, and display the output as described above. You may assume all data are valid. Provide a program introduction message that tells the user how to use the program.

  Write a complete c# program in console mode to load the data

Write a complete C# program in console mode to load the data file as a sequential file using C# System.IO library into an ArrayList data structure (using the System.Collection library) Store each line in the file as a separate record.

  Website design html urgent

It's all about Website design which I am taking as in class. It is going to be web site. 3 web pages, 2 font styles, 2 font sizes, 2 colors minimum.

  Create c# application that lets user select training course

Create a C# application (named TrainingSelector) that lets the user select a training course from a ListBox and a location from another ListBox.

  Develop an asp.net web page

Develop an ASP.NET web page that will allow the students to submit information about themselves, and the courses that they are taking on-line. The information will be stored in an MS-SQL Server Express 2008 database, named College.

  Add insert and edit menu options

Add Insert and Edit menu options - Insert will allow the user to insert a new account in a position of his choice

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