using System; using System.Text; using System.Threading; namespace thread01 { public class Counter { private int _count=0; private int _even=0; public int Count { get { return _count; } } public int EvenCount { get { return _even; } } private Object theLock = new Object(); public void UpdateCount() { lock (theLock) { _count = _count + 1; if (Count % 2 == 0) // An even number { _even += 1; } } } } class Program { static void Main(string[] args) { Counter count = new Counter(); ParameterizedThreadStart starter = new ParameterizedThreadStart(Program.UpdateCount); Thread[] threads = new Thread[10]; for (int x = 0; x < 10; ++x) { threads[x] = new Thread(starter); threads[x].Start(count); } for (int y = 0; y < 10; ++y) { threads[y].Join(); } Console.WriteLine("Total: {0} - Even: {1}", count.Count,count.EvenCount); Console.ReadKey(); Console.ReadKey(); } static void UpdateCount(object param) { Counter count = (Counter)param; for (int z = 1; z
destination mac address
structure variable can access the variable but class object can access the function also
The requirements for mutual exclusion are as follows 1. Only one process at a time is allowed to enter mutual its critical section for a resource. 2. A process that halts in its non-critical section must do so without interferring with other processes. 3. It must no be possible for a process requirning access to a critical section to be delayed indefinitly. 4. A process must not be delayed if it wishes to enter a critical section if there is no other process using it. 5. No assumptions are made about relitive process speeds or number of processes. 6, A process remains in it critical section for a finite amount of time only.
Variable
The default access specifier for a class is private. The default access specifier for a struct is public. It does not matter if it is a function or a variable.
mutual exclusion makes sure that concurrent processes access shared resources or data in a serialized way. if a process say Pi is executing in its critical section , then no other processes can be executing in their critical section.
An access specifier is a keyword applied to a variable, or method, which indicates which parts of the program are permitted to access it.
The Critical section problem occurs when the processors are in a Network. For eg consider that 3 processors share same database at a time, if one processor wants to update the database then no other process will get the access to that database. This point is called as critical section. Temporarily the connection between the other 2 system will be dropped.
Named access lists can be identified by alphanumeric names while standard access lists cannot
r+ is the keyword
Random Access Memory (RAM)
Here is the algorithm of the algorithm to write an algorithm to access a pointer in a variable. Algorithmically.name_of_the_structure dot name_of_the _field,eg:mystruct.pointerfield