Can someone give more explain for single-threaded and multi-threaded processes
Is single threaded process contains only one thread? or it means that that process can contain multiple threads and can run only one thread at a time, then context-switch between them?
If i run a java program on a single core processor is the second one would be true?
Can someone explain it further?
A single-threaded process is a process with a single thread. A multi-threaded process is a process with multiple threads.
The naming is based on the static configuration, i.e. you could look at the process when execution is suspended and say if it's single-threaded or multi-threaded. Whether or not the threads are executed on a single core or multiple cores doesn't matter as far as the nomenclature goes.
A process with multiple threads all executing on a single core can have race conditions, as can a process with multiple threads executing across multiple cores. Distinguishing the two situations is important for performance evaluation but counter-productive for correctness (i.e. it's useful to assume that each thread is on a separate CPU when considering potential races).
A single-threaded program is a program that only uses one thread. The process might have additional threads; for your example of the Java runtime, you can expect to have a finalizer thread and perhaps one or more threads for garbage collection. It's a single-threaded program running in a multi-threaded process.
(I've heard "process" defined as "the abstraction of a program in execution", i.e. you write a program and then execute it in a process.)