Search Results

Search found 12 results on 1 pages for 'dotnetbeginner'.

Page 1/1 | 1 

  • Deadlock sample in C#.net

    - by DotNetBeginner
    Can anybody give a simple Deadlock sample code in c#.net ? And please tell the simplest way to find deadlock in your C#.net code sample.(May be the tool which will detect the dead lock in the given sample code.) NOTE: I have VS 2008

    Read the article

  • What is the meaning of ": base" in the constructor definition ?

    - by DotNetBeginner
    What is the meaning of ": base" in the costructor of following class(MyClass) ? Please explain the concept behind constructor definition given below for class MyClass. public class MyClass: WorkerThread { public MyClass(object data): base(data) { // some code } } public abstract class WorkerThread { private object ThreadData; private Thread thisThread; public WorkerThread(object data) { this.ThreadData = data; } public WorkerThread() { ThreadData = null; } }

    Read the article

  • Deadlock sample in .net?

    - by DotNetBeginner
    Can anybody give a simple Deadlock sample code in c# ? And please tell the simplest way to find deadlock in your C# code sample. (May be the tool which will detect the dead lock in the given sample code.) NOTE: I have VS 2008

    Read the article

  • Using SetThreadAffinityMask function imported from kernel32.dll in C # code.

    - by DotNetBeginner
    I am trying to set Thread Affinity using SetThreadAffinityMask function imported from kernel32.dll in C # code of mine. This is how I import SetThreadAffinityMask function from "kernel32.dll" in my C# .net code [DllImport("kernel32.dll")] static extern IntPtr SetThreadAffinityMask(IntPtr hThread, IntPtr dwThreadAffinityMask); I am creating 3 threads Thread t1=new Thread(some delegate); Thread t2=new Thread(some delegate); Thread t3=new Thread(some delegate); I wish to set Thread affinity for t1,t2 & t3 for which I am using SetThreadAffinityMask function. But I am not getting how to pass parameters to this function. SetThreadAffinityMask takes two parameters 1. HANDLE hThread 2. DWORD_PTR dwThreadAffinityMask Please help me in using SetThreadAffinityMask function in C# Thanks in advance !

    Read the article

  • What is difference between Thread Affinity and Process affinity ?

    - by DotNetBeginner
    What is difference between Thread Affinity and Process affinity ? If I have two Threads and I have duel core machine then is it possible to run these two threads parallely on the two cores ? If I use processor affinity Mask then I can control execution of a process on the cores but when I have to run threads on a particular core how can I make these threads core specific ? A very simple example will be appreciated.

    Read the article

  • Why the performance of following code is degrading when I use threads ?

    - by DotNetBeginner
    Why the performance of following code is degrading when I use threads ? **1.Without threads int[] arr = new int[100000000]; //Array elements - [0][1][2][3]---[100000000-1] addWithOutThreading(arr); // Time required for this operation - 1.16 sec Definition for addWithOutThreading public void addWithOutThreading(int[] arr) { UInt64 result = 0; for (int i = 0; i < 100000000; i++) { result = result + Convert.ToUInt64(arr[i]); } Console.WriteLine("Addition = " + result.ToString()); } **2.With threads int[] arr = new int[100000000]; int part = (100000000 / 4); UInt64 res1 = 0, res2 = 0, res3 = 0, res4 = 0; ThreadStart starter1 = delegate { addWithThreading(arr, 0, part, ref res1); }; ThreadStart starter2 = delegate { addWithThreading(arr, part, part * 2, ref res2); }; ThreadStart starter3 = delegate { addWithThreading(arr, part * 2, part * 3, ref res3); }; ThreadStart starter4 = delegate { addWithThreading(arr, part * 3, part * 4, ref res4); }; Thread t1 = new Thread(starter1); Thread t2 = new Thread(starter2); Thread t3 = new Thread(starter3); Thread t4 = new Thread(starter4); t1.Start(); t2.Start(); t3.Start(); t4.Start(); t1.Join(); t2.Join(); t3.Join(); t4.Join(); Console.WriteLine("Addition = "+(res1+res2+res3+res4).ToString()); // Time required for this operation - 1.30 sec Definition for addWithThreading public void addWithThreading(int[] arr,int startIndex, int endIndex,ref UInt64 result) { for (int i = startIndex; i < endIndex; i++) { result = result + Convert.ToUInt64(arr[i]); } }

    Read the article

  • What is the meaning of ": base" in the costructor definition ?

    - by DotNetBeginner
    What is the meaning of ": base" in the costructor of following class(MyClass) ? Please explain the concept behind constructor definition given below for class MyClass. public class MyClass: WorkerThread { public MyClass(object data): base(data) { // some code } } public abstract class WorkerThread { private object ThreadData; private Thread thisThread; public WorkerThread(object data) { this.ThreadData = data; } public WorkerThread() { ThreadData = null; } }

    Read the article

1