nullnullWorking principles about multithreading, deadlock
最近使用开发的过程中出现了一个小问题,顺便记录一下原因和方法--nullnull
/*
Author: Jiangong SUN
*/
What is multithreading ?
Every application runs with at least one thread. So what is a thread? A thread is nothing more than a process.
I've heard a thread is an execution path of applications.
Multithreading is managed internally by a thread scheduler, afunction the CLR typically delegates to the operating system.A thread scheduler ensures all active threads are allocated appropriate execution time, and that threads that are waiting or blocked (for instance, on an exclusive lock or on user input) do not consume CPU time.
Like multiple process in Windows system, multiple threads exist in process.
How to prevent deadlock ?
Lock leveling
LeveledLock lockA = new LeveledLock (10);
LeveledLock lockB = new LeveledLock (5);
reference:
http://www.albahari.com/threading/
文章结束给大家分享下程序员的一些笑话语录:
女人篇
有的女人就是Windows虽然很优秀,但是安全隐患太大。
有的女人就是MFC她条件很好,然而不是谁都能玩的起。
有的女人就是C#长的很漂亮,但是家务活不行。
有的女人就是C++,她会默默的为你做很多的事情。
有的女人就是汇编虽然很麻烦,但是有的时候还得求它。
有的女人就是SQL,她会为你的发展带来莫大的帮助。