What is multithreading? Give an example?
Answer / Nikesh Gupta
Multithreading is a method used in concurrent programming to allow the execution of multiple threads (lightweight processes) within the same program. Each thread can run independently without affecting other threads, allowing for more efficient use of system resources. Here's an example using Python's `threading` module: n```nimport threadingndef worker():n print('Thread is working...')n# Create a new threadnnew_thread = threading.Thread(target=worker)n# Start the new threadnnew_thread.start()nprint('Main thread is running...')n``
| Is This Answer Correct ? | 0 Yes | 0 No |
Explain about indexing and slicing operation in sequences?
What is anagram in python?
Explain the //, %, and ** operators in python?
What are python dictionaries?
How can files be deleted in python?
What does == mean in python?
Which is fastest implementation of python?
Tell me what are different ways to create an empty numpy array in python?
Why do list comprehensions write to the loop variable, but generators don’t?
What is the comment tag in Python ?
What is the different between range () and xrange () functions in python?
What is difference between tuple and list?