Home > Software engineering >  Written in parallel computing need how many threads
Written in parallel computing need how many threads

Time:09-26

Meet a topic:
Work with 1 million cameras, at the same time and the captured images of written into a computer at the same time, can you tell me how many threads?
If there are any obstruction, how to solve?

CodePudding user response:

How many threads commonly associated with your number of CPU cores, general auditing * 2 is about the same, for more to deal with images, you can use a message queue mechanism, then consumers multithreading out for processing

CodePudding user response:

100 camera work at the same time,
It is only through the network transmission of video streaming, is unlikely to be on a computer to realize the collection 100 usb camera at the same time,
Network transmission,
Generally will be a server program is used to receive video streams, as to how many threads, see you how to implement the network protocol to
To save the memory buffer,
Then the background with one or two threads to save buffer to the local disk

CodePudding user response:


Taobao met a topic:
There are 1 million orders, orders at the same time, and place the order of the records written into a computer at the same time, can you tell me how many threads?

CodePudding user response:

refer to the second floor danscort2000 response:
100 camera work at the same time,
It is only through the network transmission of video streaming, is unlikely to be on a computer to realize the collection 100 usb camera at the same time,
Network transmission,
Generally will be a server program is used to receive video streams, as to how many threads, see you how to implement the network protocol to
To save the memory buffer,
Then the background with one or two threads to save buffer to the local disk

How to use the network protocol, can detailed say it to me? Thank you very much!

CodePudding user response:

reference smwhotjay reply: 3/f

Taobao met a topic:
There are 1 million orders, orders at the same time, and place the order of the records written into a computer at the same time, can you tell me how many threads?

,,,,,,,,
How do you answer???

CodePudding user response:

If 5 million camera tens of thousands of a snap at the same time, should be involved in distributed computing, is very complex, may need a team to complete the,

If allowed to line up (that is, the lower real-time demand), the difficulty is much smaller, the number of threads to nuclear number * 2, by using the IOCP model,

CodePudding user response:

refer to 6th floor brk1985 response:
5 million camera if tens of thousands of a snap at the same time, should be involved in distributed computing, is very complex, may need a team to complete the,

If allowed to line up (that is, the lower real-time demand), the difficulty is much smaller, the number of threads to nuclear number * 2, by using the IOCP model,

Check back next ICOP model, thank you!!!

CodePudding user response:

Bullshit, right?
The whole 1 million camera to? Is 1 million pixels?

Really want to so much, also can do, a computer that's really not line, work is writing hard disk will be lost frames at the same time, no time to write, to compress the data, a computer not to be able to do, must cluster,

Calculate the speed is good, hard disk write speed and camera data back to the speed,
As for how to write, write a thread is OK, hard drive full speed, much also no use,
How many receiving threads, it depends on the working mechanism, the lock lock, wait wait,


By the way, where can I go down to VS2010 + VA, of resources,

CodePudding user response:

100 w a suggestion you first how much per hour under evaluation data and then assess need hardware and software resources

CodePudding user response:



reference 4 floor lanse20 response:
Quote: refer to the second floor danscort2000 response:
100 camera work at the same time,
It is only through the network transmission of video streaming, is unlikely to be on a computer to realize the collection 100 usb camera at the same time,
Network transmission,
Generally will be a server program is used to receive video streams, as to how many threads, see you how to implement the network protocol to
To save the memory buffer,
Then the background with one or two threads to save buffer to the local disk

How to use the network protocol, can detailed say it to me? Thank you very much!



1 in the first place, to build a load balancing server,
The role of the server is when the camera request to transmit data to the server, according to each server load current under dynamic data receiving server IP address
Open service at the same time, use an in-memory database or array, of the data server current connection already load records, such as dynamic updating and maintenance, use an algorithm to match the most appropriate server camera
2 to establish the data receive server cluster, each data reception and load balancing server connection, and dynamic report the current status of your camera and disk load connection
Camera commonly used real-time acquisition of data compression of video streaming transmission protocol, points the key frame and the general frame, if demand data integrity first, then USES the TCP transport all data
If does not require the integrity, key frame can use TCP transport, udp transmission ordinary frame to receive
Don't use immediately after recv receive write disk operation mode, and should use big data buffer queue, only when a piece of data to determine the end of transmission, to inform the background threads execute write disk
Such general need the number of threads can be set to the CPU core number + 2, as for you using epoll completion port or select, in this model, because it is always the basic full composite operation, therefore actually gap base is 0

3 if the data receive server cluster itself radi system is not enough, you need to do backup, then add 1 to 2 thread and perform data receiving server cluster with the remote backup server timing between backup operation, note that this operation can only be read from the disk data backup and then to the remote server, if you want to write the local disk backup to the remote server at the same time, I believe that your code will be hung with badly

CodePudding user response:

Ancient have misplaced
This is the original poster to brag

CodePudding user response:

11 references, zhao teacher reply:
ancient have misplaced
This is the original poster brag

Miss zhao, is not I brag, interview met, then the

CodePudding user response:

refer to 12 floor lanse20 reply:
Quote: 11 references, zhao four teachers response:
ancient have misplaced
This is the original poster brag

Miss zhao, is not I brag, interview met, then the

That is the interviewer brag,

CodePudding user response:

This topic don't take it too seriously, just about your opinion, is impossible, actually this subject there will be no solution, just test your idea whether there is a new place or learn what are the difficulties
  • Related