View previous topic :: View next topic |
Author |
Message |
Gentoopc Guru
Joined: 25 Dec 2017 Posts: 400
|
Posted: Sun Jan 26, 2025 9:45 am Post subject: new programming language |
|
|
hi guys) please don't rush to remove the topic. this topic is not to make another linux kernel, no this topic is to start something new without interfering with the old one. I have a question, are there people here who write compilers? can they implement something like this? how much will it cost?
programming language called "Block". The point is that we can run any parts of the code in separate blocks and on different processor cores. Let's say we have an 2-core processor and there is a function searches for an element in an array . And we would like to run this function on different CPU cores. Let's try to do this, please.
Code: |
int M[7] & {7, 2, 9, 5, 3, 6, 0}; // Here we have associated an array of numbers with the array name and its data type.
_block(0){
search_function(M[0-2]);
};
_block(1){
search_function(M[3-6]);
};
|
here we launched the function on two cores in parallel and divided the array into two parts. we transferred the first part to the processor cores with the number "0"; we transferred the second part of the array to the processor core with the number "1"; if there were more processor cores, we could create more blocks. the array sorting algorithm is being studied in this way. parallel sorting is currently being studied for the most optimal and easy one. we can also create nested blocks, which will allow more flexible programming. what disadvantages do you find in this?
I want to add more. For example, input and output. We have a display sign and it looks like this " -> " We can now display from file to file. Let's say we have a text file named "file1" and we want to transfer its contents to "file2". I think it would be logical to display the contents of file1 to file2
we want to display the contents of the file on the display. well, let's do it
display as a term similar to . I think this will be more correct. we can display any objects. for example in this example the departure area is file1, the arrival area is display.
it would also be great if we could use the "&" link instead of "=".
if we want to link a variable value to some value then it is logical to do this
we have linked a variable with a value. the sign "&" itself is very similar to a knot. which will help beginners remember better. we are as if linking two objects. it is a good mnemonic.
0 and 1 are the numbers of the processor cores. Let's say we want to distribute the code into blocks. Block is a reserved word. Let me do it this way _block. And so, let's have a function run() similar to main(). And we want to run the blocks in parallel. Well, it's not difficult, let's do it. To do this, add the order to the parameters as the second argument
Code: |
_block(0, 1){
search_function(M[0-2]);
};
_block(1, 1){
search_function(M[0-2]);
};
|
since they have the same order, they will start in parallel. if we want to change the order, then
Code: |
_block(0, 1){
search_function(M[0-2]);
};
_block(1, 2){
search_function(M[3-6]);
};
|
since they have the same order, they will be launched in parallel. if we want to change the order, then when the function is launched, the order will change. let's do this with an example.
Code: |
run(){
_block(0){search_function(M[0-2]);};
_block(1){search_function(M[3-6]);}; //search_function() will be run in parallel because no priority argument is provided.
_block(0, 1){search_function(M[0-2]);};
_block(1, 2){search_function(M[3-6]);};//so the priority will change and one block will be launched after, on different cores and at different times.
};
|
Code: |
run(){
search_function(M[0-6]); //so the search for an element in an array will happen as the operating system scheduler distributes it. The programmer does not control this.
};
|
Last edited by Gentoopc on Sun Jan 26, 2025 2:42 pm; edited 5 times in total |
|
Back to top |
|
|
sMueggli Guru
Joined: 03 Sep 2022 Posts: 531
|
Posted: Sun Jan 26, 2025 10:02 am Post subject: |
|
|
Let's assume there is a compiler that is creating machine code that does what you intend it does.
The next step would be to optimise the machine code. I assume the compiler will optimise the code so that proc 1 is searching in an anonymous array with elements {7, 2, 9} and proc 2 is searching in an anonymous array with the elements {5, 3, 6, 0}.
If the compiler is really well optimised it will produce machine code that is equivalent to "return EXIT_SUCCESS".
Search algorithms usually contain an element to search for and a collection.
Your prototype code is doing nothing. And for doing nothing you do not need to invent a new programming language. Especially you can "do_nothing()" also on one core, no need for more cores. |
|
Back to top |
|
|
sam_ Developer
Joined: 14 Aug 2020 Posts: 2108
|
Posted: Sun Jan 26, 2025 10:41 am Post subject: |
|
|
sMueggli wrote: | Let's assume there is a compiler that is creating machine code that does what you intend it does.
The next step would be to optimise the machine code. I assume the compiler will optimise the code so that proc 1 is searching in an anonymous array with elements {7, 2, 9} and proc 2 is searching in an anonymous array with the elements {5, 3, 6, 0}.
If the compiler is really well optimised it will produce machine code that is equivalent to "return EXIT_SUCCESS".
Search algorithms usually contain an element to search for and a collection.
Your prototype code is doing nothing. And for doing nothing you do not need to invent a new programming language. Especially you can "do_nothing()" also on one core, no need for more cores. |
The key terms being "side effects" and "observable". |
|
Back to top |
|
|
Gentoopc Guru
Joined: 25 Dec 2017 Posts: 400
|
Posted: Sun Jan 26, 2025 11:01 am Post subject: |
|
|
sMueggli wrote: | Let's assume there is a compiler that is creating machine code that does what you intend it does.
The next step would be to optimise the machine code. I assume the compiler will optimise the code so that proc 1 is searching in an anonymous array with elements {7, 2, 9} and proc 2 is searching in an anonymous array with the elements {5, 3, 6, 0}.
If the compiler is really well optimised it will produce machine code that is equivalent to "return EXIT_SUCCESS".
Search algorithms usually contain an element to search for and a collection.
Your prototype code is doing nothing. And for doing nothing you do not need to invent a new programming language. Especially you can "do_nothing()" also on one core, no need for more cores. |
Guys, what are you talking about? This is just an example of what is possible and necessary, and many years ago it was necessary to invent a programming language that could run functions on different processor cores in parallel. It was necessary to make the language syntax more logical a long time ago. I hid the implementation of the search function so that the example was SIMPLE, I think you understand this. |
|
Back to top |
|
|
sam_ Developer
Joined: 14 Aug 2020 Posts: 2108
|
Posted: Sun Jan 26, 2025 11:47 am Post subject: |
|
|
OpenMP and friends already exist. |
|
Back to top |
|
|
sam_ Developer
Joined: 14 Aug 2020 Posts: 2108
|
Posted: Sun Jan 26, 2025 11:48 am Post subject: |
|
|
Gentoopc wrote: | sMueggli wrote: | Let's assume there is a compiler that is creating machine code that does what you intend it does.
The next step would be to optimise the machine code. I assume the compiler will optimise the code so that proc 1 is searching in an anonymous array with elements {7, 2, 9} and proc 2 is searching in an anonymous array with the elements {5, 3, 6, 0}.
If the compiler is really well optimised it will produce machine code that is equivalent to "return EXIT_SUCCESS".
Search algorithms usually contain an element to search for and a collection.
Your prototype code is doing nothing. And for doing nothing you do not need to invent a new programming language. Especially you can "do_nothing()" also on one core, no need for more cores. |
Guys, what are you talking about? This is just an example of what is possible and necessary, and many years ago it was necessary to invent a programming language that could run functions on different processor cores in parallel. It was necessary to make the language syntax more logical a long time ago. I hid the implementation of the search function so that the example was SIMPLE, I think you understand this. |
The triviality of the example makes it difficult to discuss much else. |
|
Back to top |
|
|
wjb l33t
Joined: 10 Jul 2005 Posts: 641 Location: Fife, Scotland
|
Posted: Sun Jan 26, 2025 11:50 am Post subject: |
|
|
maybe.jl
Code: |
m = [ 7, 2, 9, 5, 3, 6, 0 ]
function search_function(value, divisor)
value % divisor == 0
end
Threads.@threads for i in eachindex(m)
hmm = search_function(m[i],3)
println(" Index:$i, Value:$(m[i]), Thread:$(Threads.threadid()), Result:$hmm")
end
|
Results:
Code: |
julia --threads=4 maybe.jl
Index:1, Value:7, Thread:1, Result:false
Index:2, Value:2, Thread:1, Result:false
Index:7, Value:0, Thread:3, Result:true
Index:5, Value:3, Thread:4, Result:true
Index:3, Value:9, Thread:2, Result:true
Index:6, Value:6, Thread:4, Result:true
Index:4, Value:5, Thread:2, Result:false
|
|
|
Back to top |
|
|
Gentoopc Guru
Joined: 25 Dec 2017 Posts: 400
|
Posted: Sun Jan 26, 2025 11:59 am Post subject: |
|
|
wjb wrote: |
Results:
Code: |
julia --threads=4 maybe.jl
Index:1, Value:7, Thread:1, Result:false
Index:2, Value:2, Thread:1, Result:false
Index:7, Value:0, Thread:3, Result:true
Index:5, Value:3, Thread:4, Result:true
Index:3, Value:9, Thread:2, Result:true
Index:6, Value:6, Thread:4, Result:true
Index:4, Value:5, Thread:2, Result:false
|
|
Guys, tell me, what do you see as the problem? A new programming language that can help parallelize tasks. Is it that hard to run a function simultaneously on different CPU cores to search for an element in an array? To do this, you need to divide the array into parts and give these parts to different CPU cores. When the search for the desired element happens, stop everything. What is the problem? The syntax of the language is logical and understandable, the syntax is not made up just because someone wanted it that way. Behind each sign there is an explanation of why it is this way and not another. Is that bad? If you use it, you know exactly why you have to write this sign and not another. Because, for example, mathematics or logic requires it, and not some one person who wanted it that way. I don’t understand why you reject this. |
|
Back to top |
|
|
pingtoo Veteran
Joined: 10 Sep 2021 Posts: 1456 Location: Richmond Hill, Canada
|
Posted: Sun Jan 26, 2025 12:24 pm Post subject: |
|
|
Gentoopc wrote: | wjb wrote: |
Results:
Code: |
julia --threads=4 maybe.jl
Index:1, Value:7, Thread:1, Result:false
Index:2, Value:2, Thread:1, Result:false
Index:7, Value:0, Thread:3, Result:true
Index:5, Value:3, Thread:4, Result:true
Index:3, Value:9, Thread:2, Result:true
Index:6, Value:6, Thread:4, Result:true
Index:4, Value:5, Thread:2, Result:false
|
|
Guys, tell me, what do you see as the problem? A new programming language that can help parallelize tasks. Is it that hard to run a function simultaneously on different CPU cores to search for an element in an array? To do this, you need to divide the array into parts and give these parts to different CPU cores. When the search for the desired element happens, stop everything. What is the problem? The syntax of the language is logical and understandable, the syntax is not made up just because someone wanted it that way. Behind each sign there is an explanation of why it is this way and not another. Is that bad? If you use it, you know exactly why you have to write this sign and not another. Because, for example, mathematics or logic requires it, and not some one person who wanted it that way. I don’t understand why you reject this. |
Same question can go back and ask you why did you reject wjb example?
wjb just shared a example do exactly you are asking. In another word, what you asking already exist.
But if you just want to use your "programming language syntax" then you will need to come up with programming language specification in order for someone to write the compiler. A simple concept example will not help anybody to write compiler. |
|
Back to top |
|
|
wjb l33t
Joined: 10 Jul 2005 Posts: 641 Location: Fife, Scotland
|
Posted: Sun Jan 26, 2025 12:24 pm Post subject: |
|
|
That's an example of pretty much optimal thread allocation without me having to waste my life manually allocating jobs to cores. If you run it with 8 cores allocated, it gets that right as well.
It's also very similar to a simplified (core independent) version of your syntax, and by "core independent" I mean the compiler parallelises the contents of the block :
Code: | block(M) {
search_function(M.each)
} |
Also, I don't think your declaration of M really needs the "[7]" because it can imply that from the array length. |
|
Back to top |
|
|
wjb l33t
Joined: 10 Jul 2005 Posts: 641 Location: Fife, Scotland
|
Posted: Sun Jan 26, 2025 12:28 pm Post subject: |
|
|
Take a look at dev-python/lark, it's an insanely nice tool for building parse trees from language grammars |
|
Back to top |
|
|
Gentoopc Guru
Joined: 25 Dec 2017 Posts: 400
|
Posted: Sun Jan 26, 2025 12:30 pm Post subject: |
|
|
wjb wrote: | That's an example of pretty much optimal thread allocation without me having to waste my life manually allocating jobs to cores. . |
this gives flexibility. you can distribute the load of the processor cores. for example, you want to use the array sorting algorithm without parallelization and on one processor core. you can set it manually. then you can implement a standard algorithm. if you want to use your own approach, then you can distribute the load on the cores, depending on your algorithm. this will give the opportunity to write programs to do meaningful things. |
|
Back to top |
|
|
Gentoopc Guru
Joined: 25 Dec 2017 Posts: 400
|
Posted: Sun Jan 26, 2025 12:35 pm Post subject: |
|
|
wjb wrote: | from language grammars |
Gentlemen, I'm sorry that you still haven't seen the problem and its solution. This language could help and remove the problem of line-by-line code execution. Yes, the code will be executed line by line, but you can collect these lines into blocks and run them in parallel. When YOU NEED IT. This is the main thing. With another approach, you will always have the problem of running code that will only be executed line by line. Even if you run the code on different threads, then all the same, when calling and creating such a thread, one will be launched earlier than the other. I propose a method of SIMULTANEOUS code execution, when it is needed. And it is needed in many places these days. |
|
Back to top |
|
|
pingtoo Veteran
Joined: 10 Sep 2021 Posts: 1456 Location: Richmond Hill, Canada
|
Posted: Sun Jan 26, 2025 12:50 pm Post subject: |
|
|
Gentoopc wrote: | wjb wrote: | from language grammars |
Gentlemen, I'm sorry that you still haven't seen the problem and its solution. This language could help and remove the problem of line-by-line code execution. Yes, the code will be executed line by line, but you can collect these lines into blocks and run them in parallel. When YOU NEED IT. This is the main thing. With another approach, you will always have the problem of running code that will only be executed line by line. Even if you run the code on different threads, then all the same, when calling and creating such a thread, one will be launched earlier than the other. I propose a method of SIMULTANEOUS code execution, when it is needed. And it is needed in many places these days. |
I encourage you to design your programming language specification. I see nothing wrong in your idea. except there are already existing programming language can do what you want already. |
|
Back to top |
|
|
Gentoopc Guru
Joined: 25 Dec 2017 Posts: 400
|
Posted: Sun Jan 26, 2025 1:11 pm Post subject: |
|
|
pingtoo wrote: |
Same question can go back and ask you why did you reject wjb example?
|
What I propose is different. It is not just another JUSTIFIED syntax. I justify each sign, I support the reasonableness of using it in this language, I do not just use it. The approach is to split the code into blocks, and as I already said, to use these blocks in different sequences. What was proposed by the respected forum member above is not that. Once again, I tell you with all due respect, I DO NOT JUST RUN THE CODE IN DIFFERENT THREADS. I BREAK THE CODE INTO BLOCKS THAT CAN BE RUN ON DIFFERENT PROCESSOR CORE IN ANY SEQUENCE. AND SUCH A PROGRAM IS BUILT FROM THESE BLOCKS. That is the point. I highlighted the text so that you can see it better. This is not aggression, this is highlighting to set an accent on the main thing. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54776 Location: 56N 3W
|
Posted: Sun Jan 26, 2025 1:42 pm Post subject: |
|
|
Gentoopc,
I don't see the difference between this topic and No need for schedulers?, which is locked.
This topic is heading the same way for the same reasons ... _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
John R. Graham Administrator
Joined: 08 Mar 2005 Posts: 10719 Location: Somewhere over Atlanta, Georgia
|
Posted: Sun Jan 26, 2025 1:51 pm Post subject: |
|
|
Gentoopc wrote: | wjb wrote: | from language grammars |
Gentlemen, I'm sorry that you still haven't seen the problem and its solution. This language could help and remove the problem of line-by-line code execution. Yes, the code will be executed line by line, but you can collect these lines into blocks and run them in parallel. When YOU NEED IT. This is the main thing. With another approach, you will always have the problem of running code that will only be executed line by line. Even if you run the code on different threads, then all the same, when calling and creating such a thread, one will be launched earlier than the other. I propose a method of SIMULTANEOUS code execution, when it is needed. And it is needed in many places these days. | There are some languages that natively support parallelism (e.g., Rust) but parallel programming libraries exist for most mainstream languages. Heck, pthreads (POSIX threads) is part of glibc, allowing you to launch regular C functions as parallel threads of execution and synchronize those threads as necessary. In short, native parallelism support is fun, but hardly necessary, and certainly not new.
- John _________________ I can confirm that I have received between 0 and 499 National Security Letters.
Last edited by John R. Graham on Sun Jan 26, 2025 2:13 pm; edited 1 time in total |
|
Back to top |
|
|
wjb l33t
Joined: 10 Jul 2005 Posts: 641 Location: Fife, Scotland
|
Posted: Sun Jan 26, 2025 1:54 pm Post subject: |
|
|
I'm just asking cos its not clear, ok? No need for all caps.
So, in your example, the 0 & 1 in the block construct is the core number to run the contents on?
Is "block" a keyword, or is it an identifier linking these two items together (so they run in sync?). I mean would there be a foo(0){...} foo(1) {} somewhere else?
If something were to follow the block constructs, what would it look like? I mean, there was another thingy using core 0 would it wait till the core 0 block finished or until the core 0 & core 1 things both finished (which I guess is the case).
Try speccing out a formal grammar for your language(it's really not hard), and writing some larger and larger example code that conforms to that grammar as it grows. It doesn't have to compile to anything initially, would just let you play with the syntax. |
|
Back to top |
|
|
pingtoo Veteran
Joined: 10 Sep 2021 Posts: 1456 Location: Richmond Hill, Canada
|
Posted: Sun Jan 26, 2025 1:55 pm Post subject: |
|
|
Gentoopc wrote: | pingtoo wrote: |
Same question can go back and ask you why did you reject wjb example?
|
What I propose is different. It is not just another JUSTIFIED syntax. I justify each sign, I support the reasonableness of using it in this language, I do not just use it. The approach is to split the code into blocks, and as I already said, to use these blocks in different sequences. What was proposed by the respected forum member above is not that. Once again, I tell you with all due respect, I DO NOT JUST RUN THE CODE IN DIFFERENT THREADS. I BREAK THE CODE INTO BLOCKS THAT CAN BE RUN ON DIFFERENT PROCESSOR CORE IN ANY SEQUENCE. AND SUCH A PROGRAM IS BUILT FROM THESE BLOCKS. That is the point. I highlighted the text so that you can see it better. This is not aggression, this is highlighting to set an accent on the main thing. |
Fair enough answer. as I have been saying and will say again, Please think and design you language specification, for example what constitute keyword, what is string, what is number/integer. before a compiler can be written there have to have some basis to target. until your specification come out no one can help.
Now just my opinion, allocation resources (CPU/Memory/IO port) usually is not programming language responsibility. It is usually the RUNTIME support, be it libraries or VM. this could be part of your specification. |
|
Back to top |
|
|
Gentoopc Guru
Joined: 25 Dec 2017 Posts: 400
|
Posted: Sun Jan 26, 2025 2:32 pm Post subject: |
|
|
wjb wrote: |
So, in your example, the 0 & 1 in the block construct is the core number to run the contents on?
. |
I'll change the examples in the topic a little. Take a look, maybe you'll understand. |
|
Back to top |
|
|
Gentoopc Guru
Joined: 25 Dec 2017 Posts: 400
|
Posted: Sun Jan 26, 2025 2:37 pm Post subject: |
|
|
this is just an example of how it could be. you as a free community could have understood long ago that you are worthy of respect, and should not memorize everything in a row. if you memorize something, then there should be strong reasons for this. i will give them to you. behind each symbol there is a rule of logic or mathematics. this is respect for those who will use it. they should understand that this is not the whim of the author. these are rules that came from other disciplines of science. this is not my programming language, this is our language, which can be developed and supplemented, but only with very reasonable things. one thing should follow from another. there should be a chain of connection everywhere, with reason. it should not be broken at the will of the author, just because he wanted it that way. this is what i am trying to convey to you. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54776 Location: 56N 3W
|
Posted: Sun Jan 26, 2025 3:07 pm Post subject: |
|
|
Gentoopc,
Compilers and schedulers already do this rather well and have for a long time. Since before the first supercomputer.
They make the best use of the available resources, without knowing in advance what resources will be available at run time. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
pingtoo Veteran
Joined: 10 Sep 2021 Posts: 1456 Location: Richmond Hill, Canada
|
Posted: Sun Jan 26, 2025 3:25 pm Post subject: |
|
|
Gentoopc wrote: |
this is just an example of how it could be. you as a free community could have understood long ago that you are worthy of respect, and should not memorize everything in a row. if you memorize something, then there should be strong reasons for this. i will give them to you. behind each symbol there is a rule of logic or mathematics. this is respect for those who will use it. they should understand that this is not the whim of the author. these are rules that came from other disciplines of science. this is not my programming language, this is our language, which can be developed and supplemented, but only with very reasonable things. one thing should follow from another. there should be a chain of connection everywhere, with reason. it should not be broken at the will of the author, just because he wanted it that way. this is what i am trying to convey to you. |
And what I try to convey to you is that "rule" and "reason" in computer science it is know as "specification". It is you start the propose therefor you need to come up with rules and reason so other can follow.
You propose a house and say here are some nails, go build the house. I think you are not going to get what you think. If you are in the IT industry long enough you will know the computer project management story for swing and tree. You never get what you want if you just use verbose conversation.
Finally I suggest in this case you don't modify your original post. Just create a new post with modified ideas. This way you can preserve the thoughts and show the progress. This will help later follower understand the reasoning.
I will not be able to be give any more help since I am not in this field and have very little experience on create compiler. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54776 Location: 56N 3W
|
Posted: Sun Jan 26, 2025 3:30 pm Post subject: |
|
|
pingtoo,
You need to read The Mythical Man-Month in case you haven't heard of it. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
pingtoo Veteran
Joined: 10 Sep 2021 Posts: 1456 Location: Richmond Hill, Canada
|
Posted: Sun Jan 26, 2025 3:33 pm Post subject: |
|
|
You mean throw more resources(people) into project does not make project finish sooner? yes I am aware of that. I have some experience with that too |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|