قناة هندسة الحاسب
835 subscribers
2.29K photos
38 videos
968 files
321 links
1. القناة مخصصة للدراسة ولمقررات القسم وأخباره، يمنع نشر غير ما يتعلق بهذا إلا في حالات استثنائية.

2. يجب استعمال الهاشتاقات لكل مقرر يراد نشر شيء يخصه، وهاشتاق #إعلان للإعلانات.
Download Telegram
#include <stdio.h>

int main() {
printf("Welcome to your new start 🙌🏻\n") ;

printf("%d . DEC .%d 🗓️\n", 30, 2023);

return 0;
}

#Coming_Soon🥁
#Juniors
12🔥1🫡1
#EC451L
البرنامج الثاني

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>

int spawn (char* program, char** arg_list)
{
pid_t child_pid;

child_pid = fork();

if(child_pid !=0)
return child_pid;
else {
execvp (program, arg_list);
fprintf (stderr, "an error occurred in execvp\n");
abort();
}
}

int main ()
{
char* arg_list [] = {
"ls",
"-l",
"/",
NULL
};

spawn ("ls", arg_list);

printf("done with main program");

return 0; }
5
#EC451L
البرنامج الأول
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

int main()
{
pid_t child_pid;

printf("the program process ID is %d\n", (int) getpid());

child_pid = fork();
if(child_pid !=0){
printf("this is the parent process, with id %d\n", (int) getpid());
printf("the child's process id is %d\n", (int) child_pid);
}
else
printf(" this is the child process, with id %d\n", (int) getpid());

return 0; }
6
#EC451L

include <signal.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>

sig_atomic_t sigusr1_count = 0;

void handler (int signal_number)
{
++sigusr1_count;
}

int main()
{
struct sigaction sa;
memset (&sa, 0, sizeof(sa));
sa.sa_handler = &handler;
sigaction (SIGUSR1, &sa, NULL);

while(1)
{
sleep(2);
printf("SIGUSR1 was raised %d times\n", sigusr1_count);}
return 0;}