C # sessions, processes, threads, thread safety

Source: Internet
Author: User

Session--process--Threads

b/S Web site, each user's access is a session, the session contains the CPU for the user in memory to open up space storage session information,

such as session, process, session has a process, the same process can have more than one thread.

session, process, number of threads:

1. When the user requests a page in the same browser (session), if only one page is opened,

Session (1), process (1), Thread (1).

2. When a user requests a page in the same browser (session), multiple windows are opened

Session (1), process (1), Thread (N).

non-thread safe:

In most cases, it refers to static variables \ Global variables, etc., if it is a static read-only variable, thread safety

Thread Safety:

Creating a critical section with lock ensures that only one thread accesses the critical section when multithreading enters the critical section, and other threads block the queue.

Reference article:

Single-threaded and multithreaded with life examples

  lock Statement (C # Reference ):Https://msdn.microsoft.com/zh-cn/library/c5kehkcz (vs.80). aspx

General solution for high concurrency scenarios: http://www.cnblogs.com/lanxiaoke/p/6657935.html#3657667

C # thread safety and lock

C # sessions, processes, threads, thread safety

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.