Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Big data-java Foundation-8day

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

Process

-

1. Processes are isolated in memory (memory is not shared).

two。 Communication between processes is through socket, which is also needed on the same computer.

Thread

-

1. A block of code that executes concurrently during program execution.

two。 Memory is shared between threads.

3. A process must have at least one thread (the main thread).

4.Thread: thread class.

Start (); / / notifies cpu that you can start executing the thread.

The block of code that the run (); / / thread actually executes. The method has no return value and no parameters.

Thread t = new Thread (); / / create a thread.

T.start (); / / run.

5.Thread.currentThread (); gets the currently executing thread.

6.yield (); / / waive the preemption right of cpu

7.sleep (int mils) / / hibernates the current thread for the specified number of milliseconds.

8.join (); / / wait for the specified thread to finish

9.Thread.setDaemon (true); / / daemon thread. Must be set before the thread starts.

10.synchronozed (lock) {.} / / synchronize the code block.

Producers and consumers

Notify: randomly notifies a thread in the waiting queue.

NotifyAll: notifies all threads in the waiting queue.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report