Visualizzazione dei risultati da 1 a 2 su 2

Discussione: difficile!!!

  1. #1

    difficile!!!

    Ciao ragazzi,

    sono nuovo e vorrei delicidazioni sul file list.h
    questo serve per gestire le liste nel kernel linux.

    come posso usare queste funzioni per gli scopi che elenco qua sotto?

    ho definito questo:
    static pcb_t *pcbFree_h;/* pointer to the head of pcbFree list */
    static pcb_t *pcbTable[20]; /*array di processi*/

    ho questa struttura

    typedef struct pcb_t {
    /*process queue fields */

    struct list_head p_next;

    /*process tree fields */
    struct list_head p_child,
    p_sib;

    struct pcb_t *p_prnt;

    /* processor state, etc */
    state_t p_state;

    S32 *p_semAdd;

    /* ... */
    } pcb_t;

    devo scrivere queste funzioni, avete delle soluzioni?

    /* initialize the pcbFree list (double linked) to contain all the elements of the array pcbTable */
    void initPcbs(void);

    /* insert the element pointed to by p onto the pcbFree list */
    void freePcb(pcb_t *p);

    /*ritorna NULL se la pcbFree e` vuota, altrimenti rimuove dalla lista pcbFree, fornisce i valori iniziali per tutti i campi dei processi (per esempio NULL o 0), e ritorna il puntatore all'elemento rimosso*/
    pcb_t *allocPcb(void);

    /*dovrebbe mettere i campi della struttura a NULL*/
    void mkEmptyProcQ(struct list_head *emptylist);

    /*ritorna TRUE se la lista e` vuota, altrimenti FALSE*/
    int emptyProcQ(struct list_head *head);

    /*insert the ProcBlk pointed to by p into the process queue*/
    void insertProcQ(struct list_head *head, pcb_t *p);

    /* remove the first (i.e. head) ProcBlk from the process queue and return a pointer to it; return NULL if the queue is empty */
    pcb_t *removeProcQ(struct list_head *head);

    /* remove the ProcBlk pointed to by p from the process queue and return if p; return NULL if the queue is empty or p is not in the queue */
    pcb_t *outProcQ(struct list_head *head, pcb_t *p);

    /* return a pointer to the first ProcBlk from the process queue; NULL if the process queue is empty */
    pcb_t *headProcQ(struct list_head *head);

    /* return TRUE if the ProcBlk pointed to by p has no children */
    int emptyChild(pcb_t *child);

    /* Make the ProcBlk pointed to by parent a child of the ProcBlk pointed to by prnt */
    void insertChild(pcb_t *parent, pcb_t *child);

    /* if p has children, remove the first one from the tree and return a pointer to it; if parent has no children, return NULL */
    pcb_t *removeChild(pcb_t *parent);

    /* if p has no parent, return NULL, else remove parent from the tree and return p */
    pcb_t *outChild(pcb_t *child);

    GRAZIE A TUTTI...

  2. #2
    Moderatore di Programmazione L'avatar di alka
    Registrato dal
    Oct 2001
    residenza
    Reggio Emilia
    Messaggi
    24,466

    Moderazione

    Il forum non è a disposizione per la risoluzione di compiti a casa, compiti d'esame o realizzazione software conto terzi.

    Si può richiedere aiuto per ottenere una mano a svolgere un esercizio o a risolvere un problema, ma questo presuppone che l'autore della discussione lavori sul problema, e non deleghi semplicemente ad altre persone tutto il lavoro.

    Esiste inoltre un Regolamento da leggere e rispettare, con tutte le norme sulla conduzione delle discussioni e sulla loro apertura in quest'area del forum.

    Suggerisco quindi la lettura del regolamento locale e l'apertura di discussioni singole, una per ogni problema a sé stante, con una soluzione o uno stralcio di codice scritto da te, da poter commentare o correggere in base alla difficoltà, all'errore o al problema specifico riscontrato, da descrivere in dettaglio.

    Ciao!
    MARCO BREVEGLIERI
    Software and Web Developer, Teacher and Consultant

    Home | Blog | Delphi Podcast | Twitch | Altro...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.