In Projects,generating build is one of the most time consuming Process.
What are the best ways to automate the code pull/rebase and build process.
What are the best ways to Optimize the build process
Related
I have a task that can be easily broken down to parallel tasks. And I have a PC with multiple processors which will run the task. I'm planning to use c++ and boost library.
I'm familliar with multithreading using multiple cores, but it's my first time with multiprocessor system. I'm not sure if boost::threads will be sufficient for efficient usage of all processors.
Should I use boost::threads or build a solution upon multiple processes? Also, I'm not familiar with MPI, but I feel it may be useful for my task.
I have made a program in c++ for changing the password of a system and I wanna run it for every 2 hours,then I end up with two choice in c++ ,one is Sleep(ms) and the other is using recent thread lib this_thread::sleep_for(2h)[ 2h using std::chrono_literals].
The doubt I have been wandering is, does long pausing an exe will work the way we want, is it any other better way than what i mentioned?
I have also planned to put my exe as a windows service.
any other better way than what i mentioned?
Yes.
I suggest, that you do not pause the program at. Simply do the thing, and exit.
Extract the scheduling part to a separate program. You don't even need to write this scheduler, because it already exists on most operating systems.
If you have some task that must be run periodically with long periods of waiting, you should use a program or script, that does the task and exits, and a scheduler, which handles the waiting. There're also questions you need to consider, for example:
do you need to start your task if the scheduled time was missed (due to reboot, for example)
do you allow several of your tasks to run at once, if time it takes to complete is longer than wait period
What you're trying to do is to implement a scheduler yourself. If this is what you want, then sleep is a posix function, and chrono::thread::sleep_for is cross-platform, so it's better to use the second one.
However, it's not generally recommended to implement schedulers, moreover, so simple ones.
It is said that thousands of processes can be spawned to do the similar task concurrently and Erlang is good at handling it. If there is more work to be done, we can simply and safely add more worker processes and that makes it scalable.
What I fail to understand is that if the work performed by each work is itself resource-intensive, how will Erlang be able to handle it? For instance, if entries are being made into a table by several sources and an Erlang application withing its hundreds of processes reads rows from the table and does something, this is obviously likely to cause resource burden. Every worker will try to pull a record from the table.
If this is a bad example, consider a worker that has to perform a highly CPU-intensive computation in memory. Thousands of such workers running concurrently will overwork the CPU.
Please rectify my understanding of the scalability in Erlang:
Erlang processes get time slices of the CPU only if there is work available for them. OS processes on the other hand get time slices regardless of whether they are idle.
The startup and shutdown time of Erlang processes is much lower than that of OS processes.
Apart from the above two points is there something about Erlang that makes it scalable?
Thanks,
Melvyn
Scaling in Erlang is not automatic. The Erlang language and runtime provides some tools which makes it comparatively easy to write concurrent programs. If these are written correctly, then they are able to scale along several different dimensions:
Parallel execution on multiple cores - since the VM understands to utilize them all.
Capacity - Since you can have a process per task and they are light weight.
The biggest advantage is that Erlang processes are isolated, like in the OS, but unlike the OS the communication overhead is small. These two traits is what you want to exploit in Erlang programming.
The problem where you have a highly contended data resource is one to avoid if you are targeting high parallel execution. The best way to go around it is to split up your problem so it doesn't occur.
I have a blog post, http://jlouisramblings.blogspot.dk/2013/01/how-erlang-does-scheduling.html which describes in some more detail how the Erlang scheduler works. You may want to read that.
I am using a simple Concurrency Runtime task_group in Visual Studio 2010 to run a single working thread to separate the work from the GUI thread.
However one of my colleagues told me that I'm using CR wrong: it was designed for parallelizing lightweight tasks with small context and not for separating bulky and I/O-dependent threads from the GUI. He said that he'd taken this from the documentation, but failed to provide any specific links.
So, what are the limitations of Microsoft Concurrency Runtime and to solve what problems I should NOT use it?
Of course CR is not portable, but let's leave it out: I'm talking about situations, when you code compiles, but you get problems nevertheless.
The concurrency runtime is a cooperative scheduling infrastructure. If you're not going to take advantage of cooperative scheduling, then you're better off creating threads when you need to, and letting the OS take care of scheduling.
If you are into cooperative scheduling, then there's really no point to wait for an IO operation to complete, because you're blocking a thread which could have otherwise been used for running other tasks, which do not depend on this IO operation to complete. If other tasks depend on the IO task to complete, you can simply make them continuations, and the ConcRT scheduler will make sure to run them when their time comes.
So it's really not about limitations here. It's simply about knowing what you're trying to achieve, and picking the right tool for the job.
As Yam mentioned, concurrency runtime does not provide the parallel execution guarantee, it just makes a potential possibility, and that is the difference between notions of tasks and threads. If you get your tasks right (not too granular to spend much time on switching between tasks, and not too coarse to always have some work for all the cores - in your case - just one), then the overhead will not be significant, and your program will be ready for running on a multi-core or a multi-processor platform, "future proof" as MSFT people like to say.
I have a GUI application, which listens to a network port from a second thread. I was looking at OpenMP and I was wondering if there are easy ways to create threads like this. I was searching for documentation, but the OpenMP site is not very convenient to navigate. Could someone help?
As far as I understand OpenMP is a compiler-assisted parallelizing framework/library targeted to heavy computations. You hint the compiler which parts of your code (usually loops) can run in parallel. The compiler does its magic (inserting library calls, sharing/unsharing variables, etc.) and, poof, the program can now run faster (sometimes) on several cores. It might be possible to do what you want with OpenMP, I don't know, but I think you are looking at the wrong tool. Doing things directly with pthreads is one alternative.