| |

VerySource

 Forgot password?
 Register
Search
View: 1403|Reply: 10

Ask the thread what is the difference between sleep and suspend?

[Copy link]

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-3-7 11:00:01
| Show all posts |Read mode
What is the difference between these two? In some places, the thread suspend still occupies a very high CPU, and it will not be occupied by changing to sleep;
In some places, I can use whatever I want.
Does anyone know why?
Reply

Use magic Report

0

Threads

52

Posts

34.00

Credits

Newbie

Rank: 1

Credits
34.00

 China

Post time: 2020-5-25 12:30:01
| Show all posts
The difference between hang and block

Take a look at the book of university operating system
Reply

Use magic Report

0

Threads

27

Posts

21.00

Credits

Newbie

Rank: 1

Credits
21.00

 China

Post time: 2020-5-26 20:45:01
| Show all posts
Simply put, suspend is to suspend your current thread, you can use resume to resume, but when you use sleep, you must wait until the time is up to resume, and sleep is to suspend your current process, not the current thread.
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-5-28 10:45:01
| Show all posts
In .net, sleep and suspend can be set indefinitely until other threads wake up. Is there any difference between them?
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2020-5-28 23:30:01
| Show all posts
The specific differences are similar to the ones upstairs ..

It is recommended that Suspend should not be used. For suspended threads, methods such as mutex or flag can be used instead.
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-6-11 10:45:02
| Show all posts
Doesn't sleep pause the current process? It should also be a thread. . .
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2020-6-29 19:45:01
| Show all posts
TO:sleep is not to suspend the current process, right? It should also be a thread. . .

It depends on where you use it..
Reply

Use magic Report

0

Threads

110

Posts

63.00

Credits

Newbie

Rank: 1

Credits
63.00

 China

Post time: 2020-6-29 22:45:01
| Show all posts
TO:.net sleep and suspend can be set indefinitely until other threads wake up. Is there any difference between them?

Sleep will automatically wake up when the time is up, and suspend will call resume to wake up...

It's still a little different...
Reply

Use magic Report

1

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

 Author| Post time: 2020-7-23 01:45:02
| Show all posts
Interruput can be used to wake up during sleep, and the thread in sleep will throw an exception. Is this similar to resume?
What I want to ask is is there any difference between threads in sleep and suspend states?
Reply

Use magic Report

0

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-7-23 12:15:01
| Show all posts
Hanging is error-prone
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list