Unix Parent-child process relationship [closed] - unix

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
i understand well the parent-child relationship in unix processes creation. But i don't understand the rationale behind it :( why do we need to fork from the current process to create a new one, then overwrite its image with a new code if any? cheers

The rationale is that unix system calls (at least originally) are "elementary" operations done by the kernel.
In practice, applications often do some specific things between fork(2) and execve(2), in particular calls to close(2) and dup2(2), also sigaction(2) to ignore some signals (with perhaps some pipe(2) syscalls done before the fork).
If you wanted to have a single syscall handling all this at a time, it would have been very complex, and less flexible.
I suggest to read some book like Advanced Linux Programming (it is free and online) or Advanced Unix Programming in addition of intro(2).
I find on the contrary the intent to separate creating a process and executing a program quite natural. I don't really understand why you want both operations to be combined.
See also this mine answer about syscalls.

Related

Last breaking changes to Ada [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
(Edited to narrow the question to Ada. Have posted other questions for Fortran and COBOL.)
I've spent some time in the past year dealing with changes to my code due to Python v2->v3 and R v3->v4 changes. It got me curious as to some of the older languages that are still in use.
I know Ada still sees occasional updates and functionality upgrades. I would assume that their mission-critical nature makes those changes smaller and more backward-compatible, but I don't really know and couldn't find it with a web search.
What and when were the last changes to Ada that was on the same rough order as the Python 2->3 changes?
Ada pays a lot of attention to reverse compatibility, to avoid breaking existing code, when making changes.
Last formal Ada release was Ada-2012, there is another one (Ada-202X) in progress.
Ada-2012 has a lot that Ada-83 doesn't, but I'd be surprised if there was anything more than trivial work to build an Ada-83 project (or Ada-95 or Ada-2005) in Ada-2012.
There are some differences though : from Ada-83 to Ada-2012 As you can see, there's really not much to say for 30 years of development.

Communication between Different programs in Different Computers (C# or Python) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm building a program that I want to be able to exchange information with other programs running in another computer. I started using C# and a library called SimpleTCP. The main issue is that is too simple and only send and receive messages.
I'm looking for something that I can predetermine functions that one or the other can call from each other.
I looked on google and stack overflow but I was unable to find an appropriated subject to study, what should I be looking for to learn this? Thank you
The most complete protocol for what you want is gRPC. There is a learning curve but worth it in my opinion. https://github.com/grpc/grpc
There is a way but it's little bit different
Such programs like this written in tow different languages
You can make a center database between the both programs
In this situation it's very easy to communicate and receive ,send data
You can mysql ,oracl, mariadb or any Database you prefer

Recursion When to use it? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
So we just finished the subject recursion in school and I am still wondering "why?".
I feel like I have just learned a hell of a lot about math in a programming way with the sole purpose of passing an exam later on and then never again.
So what I want to know is when to use it? I can only find people saying "when you want to call a function within itself" but why would you do that?
Recursion is the foundation of computation, every possible program can be expressed as a recursive function (in the lambda calculus). Hence, understanding recursion gives you a deeper understanding of the principles of computation.
Second, recursion is also a tool for understanding on the meta level: Lots of proofs over the natural numbers follow a pattern called "natural induction", which is a special case of structural induction which in turn allows you to understand properties of very complex systems in a relatively simple way.
Finally, it also helps to write good (i.e. readable) algorithms: Whenever there is data to store/handle in a repetitive calculation (i.e. more than incrementing a counter), you can use a recursive function to implicitly manage a stack for you. This is also often very efficient since most systems come with a machine stack at hand.

Can I write go library to be used from another languages? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm writing relatively small, but not simple networking library which is going to be used at least from C,java,python,ruby and C#. Is there a way to make go bindings to the other languages the way in can be done form C? If not is there other way?
Right now, you can't write libraries in Go that can be used in other languages. Go has a runtime environment that does a lot of things (like sheduling go-routines, collecting garbage) for you. This runtime environment is written under the assumption that it controls the whole program. This assumption does not hold if Go code would be used from inside another language, as the Go library cannot influence the binary that uses it.
I imagine that a JSON service would do what you describe.
Have a look at the json test for a simple example
It wouldnt matter what languages you used to set and get data from your app

Optimizing an SBCL Application Program for Speed [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I've just finished and tested the core of a common lisp application and want to optimize it for speed now. It works with SBCL and makes use of CLOS.
Could someone outline the way to optimize my code for speed?
Where will I have to start? Will I just have to provide some global declaration or will I have to blow up my code with type information for each binding? Is there a way to find out which parts of my code could be compiled better with further type information?
The programm makes heavy use of a single 1-dimensional array 0..119 where it shifts CLOS-Instances around.
Thank you you Advance!
It's not great to optimize in a vacuum, because there's no limit to the ugliness you can introduce to make things some fraction of a percent faster.
If it's not fast enough, it's helpful to define what success means so you know when to stop.
With that in mind, a good first pass is to run your project under the profiler (sb-sprof) to get an idea of where the time is spent. If it's in generic arithmetic, it can help to judiciously use modular arithmetic in inner loops. If it's in CLOS stuff, it might possibly help to switch to structures for key bits of data. Whatever's the most wasteful will direct where to spend your effort in optimization.
I think it could be helpful if, after profiling, you post a followup question along the lines of "A lot of my program's time is spent in <foo>, how do I make it faster?"

Resources