That's going to depend on the specific country: many countries have their own quirks either through convention or legidlation, for historical reasons.
For Ireland, since you mentioned that specifically, the power to dissolve parliament resides with the president, not the prime minister.
The formal powers and functions of the President are prescribed in the Constitution. Many of the powers of the President can only be exercised on the advice of the Government, but the President has absolute discretion in other areas.
From the Official site of the Irish presidency : Constitutional Role
The President's powers include:
• Appointment of the Taoiseach, members of the Government, judges and other officials;
• Summoning and dissolving the Dáil, and convening the Oireachtas;
Later on on the same page
Ireland is a parliamentary democracy. The National Parliament (Oireachtas) consists of the President and two Houses: Dáil Éireann (House of Representatives) and Seanad Éireann (the Senate) whose functions and powers are laid out in the Constitution (Bunreacht na hÉireann).
The President summons and dissolves Dáil Éireann on the advice of the Taoiseach.
If a Taoiseach no longer has the support of the majority of Dáil Éireann, the President may choose to call for fresh elections, by signing a proclamation dissolving the Dáil. However, the President may also refuse to dissolve the Dáil, in which case members of the Dáil must nominate an alternative Government. Since the foundation of the State, this power of refusal has never been exercised.
Following a general election, Dáil Éireann is summoned by the President, on the advice of the Taoiseach. The President must follow the advice of the Taoiseach.
So in theory the president has the freedom to decide whether or not to dissolve parliament. In practice no president ever has and has followed the advice of the Taoiseach (prime minister), so what would happen if the president overruled the Taoiseach, the cabinet was publically divided, or the president unilaterally announced the dissolution its unknowable, and would probably depend on the circumstances.
The UK has a similar system, with the power to dissolve parliament resting purely with the monarch. But in practice, the monarch will always follow the advice of the government, as expressed in a personal meeting with the prime minister.
So in reality the Irish president had more constitutional basis to act independently than the British monarch does in their respective systems, despite their analogous positions in their governments.