I have a question about Python code execution and core allocation.

Asked 2 years ago, Updated 2 years ago, 18 views

It wouldn't matter if I could run just one Python code.

I wonder how cpu will be allocated when operating different Python codes.

As far as I know, Python uses only one core unless it is multiprocessed.

So, if you run more than two Python codes, I wonder if you're going to assign all of these codes to one main core, or if each core is going to take over one code.

I'd like you to check it out for yourself, but... Unfortunately, I don't know how to check the assigned tasks by cpu core. ㅠ<

I'm leaving this question because I think there might be people who have checked it out with a similar curiosity as me.

python

2022-09-20 16:02

1 Answers

Scheduling is the role of the OS. You need to find out how your OS distributes and switches cores in a merciless core environment.

Python with a new interpreter to do that you mentioned

a processing is gil free how to execute the code. At this point in what core is assigned to each interpreter is entirely os's decision. Such as in the core of the core switching to another depending on the situation and can run, too.


2022-09-20 16:02

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.