Some questions about Java threads, processes

Source: Internet
Author: User

1. On multicore hardware, can multiple threads of the same process in Java run on different CPUs?

It should be possible to run a simulation program on Eclipse, a dead loop thread can occupy the system (4 cores, Win7) andthe cpu,4 of such a thread just occupies 100%. This can be explained from the side that threads can be assigned to different cores. Of course, a specific system should be considered.

2, each Android app for a virtual machine, corresponding to a process, so that there is not a lot of virtual machine copy, wasting a lot of memory space?

No.
The reason is: 1, each app is running on the process created by zygote
2, the virtual machine is also created in zygote
3, so each app can share the memory space of the parent process zygote
4, and this share uses cow (copy-on-write), that is, read-only files can be shared between the parent-child process, will not be modified, the modified part of the changes when the copy.
5, so, not only can not waste space, but also save time

Some questions about Java threads, processes

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.