15
votes
Can multi-threading improve performance of an IO-bound process?
I/O performance has two aspects that you must distinguish: latency and throughput. One measures how long you have to wait for the first byte of a response, the other how long you have to wait ...
12
votes
Why is universal newlines mode deprecated in Python?
After stumbling across this question, I updated the documentation to be clearer about what's going on (https://github.com/python/cpython/pull/11646/files).
The confusingly cryptic table entry for 'U' ...
12
votes
How to Unit-Test a parser of a file?
I want to write tests for it.
What you are intending to test?
I want to use TDD. I'm refactoring a parser and want to test the 'parse()' method.
So the aim is to clean things up.
I would argue that ...
10
votes
How does the Base Address Registers (BARs) in a PCI card work?
This question should be moved to stackoverflow. Maybe someone will do that.
Am I correct?
Essentially, yes.
Each BAR holds the address of a communication area. This address can be set and read ...
9
votes
How to Unit-Test a parser of a file?
This approach may work but as far as I understand from unit test methodology, unit-tests shouldn't perform I/O
I think you are overlooking the elephant in the room here: your parser should not ...
8
votes
Accepted
Separate Thread Pools for I/O and CPU Tasks
To improve efficiency, I wanted to have one thread pool perform the I/O section and have it pass tasks to another thread pool that performs the CPU section. That way, it's unlikely that all threads ...
8
votes
Accepted
What does "data bus control" mean?
Yes. The DMA controller takes ownership of the bus for the duration of the transfer.
That said, I feel obliged to point out that at least on PC-based machines, DMA controllers have been almost ...
7
votes
Accepted
How data is accessed in Memory-Mapped I/O?
So basically you access the device controller registers through memory.
Not exactly, which is why the diagram in the question doesn't quite depict memory-mapped I/O.
Memory-mapped I/O uses the same ...
7
votes
How do I apply TDD to read/write functions?
Start with the Read Function.
In the test setup: create the database and add test data. either via migration scripts or from a backup. As this is not your code, it doesn't require a test in TDD
In ...
6
votes
How do I apply TDD to read/write functions?
I often just do a write followed by a read. e.g. (pseudocode)
Foo foo1 = setup some object to write
File tempfile = create a tempfile, possibly in memory
writeFoo(foo1, tempfile)
Foo foo2 = ...
6
votes
How do peripherals decide which address to use in memory-mapped I/O?
It depends on the bus specification.
For example, PCI uses an enumeration scheme whereby the OS probes for each possible device, and finding a device, asks it how many memory blocks it wants, and ...
6
votes
What does "address space" means when talking about IO devices?
An Address Space is simply a range of allowable addresses.
An I/O address is a unique number assigned to a particular I/O device, used for addressing that device. I/O addresses can be memory-...
6
votes
Accepted
Are streams of binary data considered a form of bit banging?
Are streams of binary data considered a form of bit banging?
No. The term bit banging is only used when referring to creating electrical signals on a processor pin.
There are two ways to create the ...
6
votes
Can multi-threading improve performance of an IO-bound process?
If you are truly I/O bound, such as your network link being saturated, then no matter how many processes you run you will not be able to transmit requests and receive responses any faster.
If you are ...
5
votes
What does "address space" means when talking about IO devices?
The basic idea is pretty simple: a chip can have one bus to connect to memory, and a second bus to connect to I/O devices--or it can share a single bus between the two.
In practice, even a CPU that ...
5
votes
Separate Thread Pools for I/O and CPU Tasks
ioService must not be of availableCores() size. Its size depends on network characteristics of a computer and may even be unbounded.
Don't block or wait, this wastes time. Submit a Runnable to ...
5
votes
Accepted
How does disk wiping software access my hard disk?
The kernel has a very defined API for file handling
Right. And that API includes other more granular capabilities. There is an API to allow access to e.g. format a drive, get model and serial ...
5
votes
Can multi-threading improve performance of an IO-bound process?
Let's say the application is talking with some API, and has to make various API calls. If we have multi-threading, we can make those API calls in parallel, and boost the performance.
This is correct. ...
5
votes
Accepted
What does it mean to be "truly" asynchronous?
Here it just means that while the I/O operations themselves may be asynchronous, the completion events are dispatched synchronously in Windows (ie, when you check the completion port).
UNIX signals ...
4
votes
How do I apply TDD to read/write functions?
Don't. Don't unit test I/O. It is a waste of time.
Unit test logic. If there's a lot of logic that you want to test in the I/O code, you should refactor your code to separate the logic of how you do ...
4
votes
How to Unit-Test a parser of a file?
as far as I understand from unit test methodology, tests shouldn't perform I/O
You have to distinguish which kind of tests you are talking about:
if you want to use TDD with small "write test" - "...
4
votes
Can the CPU manipulate the pins of an IO port directly?
Based on what I know so far, when you plug an IO device into an IO
port (for example, when you plug a printer into a parallel port), the
printer will be represented to the CPU as just another RAM ...
4
votes
Accepted
One thread for all database operations or one thread for each db operations?
Is it a good solution ? or not ? and why ?
Databases have been among us for a long time, and a lot of people already did the thinking for us ;)
You have a problem of Transactional Serializability.
...
4
votes
Accepted
Reading huge (up to 32 GB) file in multithreading env?
Accessing one file by multiple threads for reading 1MB chunks is trivial, just determine the file length and the number of chunks beforehand. Queue up the the chunks and let them process in parallel ...
4
votes
Accepted
Sequential or parallel access to hard disk in multithread program?
Assuming all are to the same disk, all read and writes will ultimately be performed one at a time. Assuming each file takes about the same amount of time by itself, your job overall will take about 4x ...
4
votes
Sequential or parallel access to hard disk in multithread program?
It is hard to tell what will ultimately happen at the drive level. In between your Java program and the physical head(s) of the hard drive there will be multiple stages of buffering and scheduling ...
4
votes
Applying function to file line by line or read entirely into structure first?
You can always measure, but you might be surprised at the results, especially for sequential access. People don't think about optimizations done at lower levels of abstraction. For example, your ...
4
votes
Accepted
Best way to reduce database writes?
Assuming that you really need this counter, does it really have to be constantly updated every time a user sends a message? Could you use a more "granular" counter which increments every ...
4
votes
Accepted
Operating systems - whose responsibility is it to coordinate process I/O requests?
A blocking system call will simply not return control to the process that called it. Either the data will become available during the time slice that the scheduler allocated to that process, so that ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
io × 94java × 16
multithreading × 13
c++ × 7
c × 7
hardware × 7
file-handling × 6
computer-architecture × 6
c# × 5
asynchronous-programming × 5
async × 5
cpu × 5
design × 4
memory × 4
linux × 4
operating-systems × 4
design-patterns × 3
python × 3
performance × 3
architecture × 2
unit-testing × 2
data-structures × 2
functional-programming × 2
language-agnostic × 2
node.js × 2