Μετάβαση στο κύριο περιεχόμενο
← ΜαθήματαSenior Deep-DivesΕνότητα 1 · Concurrency & Async InternalsΤο GIL — τι είναι, τι δεν είναιpredict2 / 161
+75 XP
Εργασία🌐 shown in EN
📝 **Task:** Predict the three-line verdict the snippet prints — one line per workload kind, in the order shown. 📋 Implement the function above. Tests run automatically. 💡 **Hint:** Re-read the theory if you get stuck.
Πρόβλεψε έξοδο

Διάβασε τον κώδικα προσεκτικά

# Each function reports whether moving from 1 thread to 4 threads
# in CPython would yield a real speedup. The verdict is decided
# by the GIL rules, NOT by wall-clock measurement.

def cpu_bound():
    # Pure Python tight loop — GIL serializes every bytecode op.
    return "no_speedup"

def io_bound():
    # time.sleep / socket waits release the GIL.
    return "speedup"

def numpy_bound():
    # NumPy's C code releases the GIL during heavy array ops.
    return "speedup"

print(cpu_bound())
print(io_bound())
print(numpy_bound())

# What does this print? Type your prediction.

Τι θα εμφανίσει το πρόγραμμα; Γράψε εδώ: