Is a Thread the same as an Interupt?

Started by
10 comments, last by Esap1 24 years ago
Well is it?
Advertisement
No a thread is a discrete sequence (or unit, depending on how you look at it) of execution. An interrupt is a method of signalling the operating system of an event.
Some interupts don''t go to the operating system, they go directly to the proessor, and execute the code at the given adress in the interupt vector, howerver, a os may of cource exchange the vector or the code at the given adress.

I think this is an easier explanation:

A thread is the same as a process, a calculation of any kind that is sent to the processor. MS Windows calls it threads, UNIX calls them processes. Whenever you run a program, it''s got at least one thread, but if you want several things to happend at the same time (multitasking) you create several threads.

Interrupts (or IRQs) are signals to the processor that the interrupt sender wants attention about something. The computer BIOS manages the IRQ adresses (channels) and if two devices should have the same IRQ adress, they don''t work or they work erroneously or very slow.

============================
Daniel Netz, Sentinel Design
"I'm not stupid, I'm from Sweden" - Unknown
============================Daniel Netz, Sentinel Design"I'm not stupid, I'm from Sweden" - Unknown
During an interupt the processor goes off and executes a totally diferent bit of code (an Interupt Service Routine if I remember rightly), once this code returns, the processor continues where it left off with the program.

With threads, the OS splits program execution up into chunks, and switches between them every so often. This switch is probably performed by an ISR on the Timer Interrupt, so there are similarities between Interrupts (or rather, the code executed by an interrupt, which I think is what you meant) and threads.

Hope I haven''t confused you with my dodgy explanations

George.

"Who says computer games affect kids, imagine if PacMan affected us as kids, we'd all sit around in a darkened room munching pills and listening to repetitive music....uh oh!"

George. F"Who says computer games affect kids, imagine if PacMan affected us as kids, we'd all sit around in a darkened room munching pills and listening to repetitive music....uh oh!"
quote:Original post by Spiff

A thread is the same as a process, a calculation of any kind that is sent to the processor. MS Windows calls it threads, UNIX calls them processes. Whenever you run a program, it''s got at least one thread, but if you want several things to happend at the same time (multitasking) you create several threads.


I think that technically, Windows has both threads and processes (as can UNIX, but it''s less common to use threads since their inter-process communication is mor well-refined.) Each process runs in at least 1 thread, and may optionally use more. Threads share the memory space of their calling process, whereas processes are (supposedly) isolated from each other, and when you try to go outside that space you get your traditional crash, eg. illegal operation in Windows.
In Windows, process = application and contains at least 1 thread. That process can spawn more worker or user-interface threads to utilize multithreaded programming techniques.
Spiff: IRQs are not interrupts. IRQs are the channels on the PIC, which generates some hardware interrupts. Interrupts are not necessarily generated by hardware, and can be triggered by applications.
From what I know, threads are processes that are each alocated a certain percentage of CPU time.
An interrupt is a message that is send to Windows (or DOS, or whatever) after a certain time has passed.

I think this is right. Otherwise, does it really matter if you know the difference in Windows (don''t answer that)!!!
Interrupts are generated whenever a certain event occurs that is appropriate to the interrupt type. It is not limited to a "certain time has passed." Examples of interrupts include divide by zero exceptions, NMI, singlestep and breakpoint interrupts.

This topic is closed to new replies.

Advertisement